blob: 85c92ad355d951609c8c22fbf5f1fb919be21ff2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
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<BACKEND> is the name of the backend
to use. The class B<SlackBuild::Registry::Backend::I<BACKEND>> must
exist. The arguments (I<KW =E<gt> 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<SlackBuild::Registry::Pattern> object B<$pattern>.
=cut
sub lookup {
my ($self, $pattern) = @_;
return $self->backend->lookup($pattern);
}
1;
|