NAME
ALPM::DB - ALPM database class.
SYNOPSIS
... load ALPM with options first ...
my $localdb = ALPM->localdb;
my $name = $localdb->name;
my $perl = $localdb->find('perl');
my $url = 'ftp://ftp.archlinux.org/community/os/i686';
my $syncdb = ALPM->register_db( 'community' => $url );
for my $pkg ( $syncdb->search( 'perl' ) ) {
printf "%s %s\n", $pkg->name, $pkg->version;
}
for my $pkg ( $syncdb->find_group('xfce4')->pkgs ) {
print join( q{ }, $pkg->attribs('name', 'version') ), "\n";
}
my @cache = $syncdb->pkgs;
METHODS
name
Usage : my $name = $db->name;
Returns : The name of the repository database.
Ex: core, extra, community, etc...
url
Usage : my $url = $db->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.
Note : This only returns one of the URL's of the repository.
find
Usage : my $package = $db->find( $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.
find_group
Usage : my $group = $db->find_group( $group_name );
Returns : An ALPM::Group object if it is found or undef.
ALPM::Group objects have two accessors:
$group->name - the name of the group
$group->pkgs - A list of package objects in the group
search
Usage : my @results = $db->search( 'foo', 'bar', 'baz' );
Params : A list of strings to search for.
Returns : An array of package objects whose name matched the search.
pkgs
Usage : my @pkgs = $db->pkgs;
Params : None
Returns : An array of all packages in the DB.
groups
Usage : my @groups = $db->groups;
Returns : An array of all groups in the DB.
add_url
Usage : $db->add_url( 'ftp://ftp.archlinux.org/extra/os/i686' );
Purpose : This adds a mirror for the repository.
Params : The URL for the root of the remote repository.
set_pkg_reason
Usage : $db->set_pkg_reason( 'perl', 'explicit' );
Params : The package name and a new package reason.
Reason can be 'explicit', 'implicit', 0, or 1.
Purpose : Changes the reason for installing the given package.
Comments : Probably best to use on local database ...
Returns : Nothing.
update
Usage : $db->update;
Params : If provided a parameter, the update is forced.
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, <juster at cpan dot org>
COPYRIGHT AND LICENSE
Copyright (C) 2011 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.