ALPM
view release on metacpan or search on metacpan
lib/ALPM/DB.pod view on Meta::CPAN
=head1 NAME
ALPM::DB - Database base class, inherited by local and sync databases.
=head1 SYNOPSIS
use ALPM::Conf qw(/etc/pacman.conf);
my $db = $alpm->localdb;
printf "Playing with %s database\n", $db->name;
my $perl = $db->find('perl') or die 'where is perl';
$db = $alpm->register('community') or die;
$db->add_server('ftp://ftp.archlinux.org/community/os/i686') or die;
for my $pkg ($db->search('perl')){
printf "%s\t%s\n", $pkg->name, $pkg->version;
}
for my $pkg ($db->find_group('xfce4')){
printf "xfce4:\t%s\t%s\n", $pkg->name, $pkg->version;
}
my %grps = $db->groups;
while(my($g, $pkgs) = each %grps){
printf "%s\t%s\n", $g, $_->name for(@$pkgs);
}
=head1 OBJECT METHODS
=head2 name
$NAME = $DB->name()
=over 4
=item C<$NAME>
The previously assigned name of the database or 'local' for the local database.
=back
=head2 pkgs
@PKGS = $DB->pkgs()
=over 4
=item C<@PKGS>
A list of packages in the package cache for this database.
=back
=head2 find
$PKGS | undef = $DB->find($NAME)
=over 4
=item C<$NAME>
The exact name of a package to look for.
=item C<$PKGS>
On success, an L<ALPM::Package> object of the package found.
=item C<undef>
On failure, returned when a matching package is not found.
=back
=head2 search
@PKGS = $DB->search($MATCH)
=over 4
=item C<$MATCH>
A substring to search for within the names of packages.
=item C<@PKGS>
( run in 1.211 second using v1.01-cache-2.11-cpan-99c4e6809bf )