package SlackBuild::Registry; use strict; use warnings; use Carp; use SlackBuild::Base qw(backend:ro); =head1 NAME SlackBuild::Registry - registry of completed builds =head2 new $x = new SlackBuild::Registry(BACKEND, KW=>VAL, ...) Creates new registry object. I is the name of the backend to use. The class B> must exist. The arguments (I VAL> pairs) are passed to its constructor. =cut sub new { my $class = shift; my $backend = shift or croak "no backend specified"; $backend = "SlackBuild::Registry::Backend::$backend"; eval "use $backend"; croak $@ if $@; my $self = bless {}, $class; $self->{backend} = $backend->new(@_); return $self; } =head2 lookup @a = $x->lookup($pattern) Returns a sorted array of SlackBuild::Registry::Record objects matching the B object B<$pattern>. =cut sub lookup { my ($self, $pattern) = @_; return $self->backend->lookup($pattern); } 1;