NAME

ALPM::DB - Database base class, inherited by local and sync databases.

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);
}

OBJECT METHODS

name

$NAME = $DB->name()
$NAME

The previously assigned name of the database or 'local' for the local database.

pkgs

@PKGS = $DB->pkgs()
@PKGS

A list of packages in the package cache for this database.

find

$PKGS | undef = $DB->find($NAME)
$NAME

The exact name of a package to look for.

$PKGS

On success, an ALPM::Package object of the package found.

undef

On failure, returned when a matching package is not found.

@PKGS = $DB->search($MATCH)
$MATCH

A substring to search for within the names of packages.

@PKGS

A list of found packages, in the form of ALPM::Package objects. This may be empty.

groups

%GROUPS = $DB->groups()
%GROUPS

A hash (name/value pairs) of groups contained within the database. Each group name is followed by an arrayref of ALPM::Package objects. This may be empty.

find_group

@PKGS = $DB->find_group($NAME)
$NAME

The exact name of a group to search for.

@PKGS

A list of packages which belong to the given group name. If no group was found then this is empty.

SEE ALSO

ALPM::DB::Local, ALPM::DB::Sync, ALPM::Package, ALPM

AUTHOR

Justin Davis, <juster at cpan dot org>

Andrew Gregory <apg@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2015 by Justin Davis

Copyright (C) 2015 by Andrew Gregory <apg@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.