NAME
ALPM::DB - Class to represent a libalpm database
SYNOPSIS
... load ALPM with options first ...
my $localdb = ALPM->local_db;
my $name = $localdb->get_name;
my $perl = $localdb->get_pkg('perl');
my $url = 'ftp://ftp.archlinux.org/community/os/i686';
my $syncdb = ALPM->register_db( 'community' => $url );
my $found_ref = $syncdb->search('perl');
for my $pkg (@$found_ref) {
print "$pkg->name $pkg->version\n";
}
my $cache = $syncdb->get_pkg_cache;
METHODS
get_name
Usage : my $name = $db->get_name;
Returns : The name of the repository database.
Ex: core, extra, community, etc...
get_url
Usage : my $url = $db->get_url;
Returns : The url of the repository, the same one the DB
was initialized with or the empty string if this
is a 'local' database.
get_pkg
Usage : my $package = $db->get_pkg($package_name)
Params : $package_name - Exact name of the package to retrieve.
Returns : An ALPM::Package object if the package is found.
undef if the package with that name is not found.
search
Usage : my $results_ref = $db->search( 'foo', 'bar', ... );
Params : A list of strings to search for.
Returns : An arrayref of package objects that matched the search.
get_pkg_cache
Usage : my $cache_ref = $db->get_pkg_cache;
Returns : An arrayref of package objects in the DB cache.
update
Usage : $db->update;
Purpose : Updates the local copy of the database's package list.
Comment : This needs to create a transaction to work, so make sure
you don't have any active transactions.
Things may work incorrectly if the database is not updated.
If there is no local db copy, the package cache will be empty.
Returns : 1
TODO : Provide different return values like alpm does.
SEE ALSO
ALPM, ALPM::Package, ALPM::Transaction
AUTHOR
Justin Davis, <jrcd83 at gmail dot com>
COPYRIGHT AND LICENSE
Copyright (C) 2009 by Justin Davis
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.