ALPM::Package - libalpm packages of files, with dependencies, etc.
use ALPM::Conf qw(/etc/pacman.conf); my $perlpkg = $alpm->localdb->find('perl'); ## All package methods are accessors. my $name = $perlpkg->name(); print "$name rocks!\n"; ## Here is an ugly trick. Please forgive me. print "@{[$perlpkg->name]} rocks!\n"; ## Dependencies are arrayrefs of hashrefs (AoH): print "$name depends on:\n"; for my $deps (@{$perlpkg->depends}){ print "\t@{$dep}{'name', 'mod', 'version'}\n"; } ## File lists are also arrayrefs of hashrefs (AoH): print "$name owns files:\n"; for my $f (@{$perlpkg->files}){ printf "\t%s %o %d\n", $f->{'name'}, $f->{'mode'}, $f->{'size'}; } ## Others lists are arrayrefs of scalars: print "$name is licensed under: @{$perlpkg->licenses}";
This class is a wrapper for all of the alpm_pkg_... C library functions of libalpm. You retrieve the package from the database and you can then access its information.
alpm_pkg_...
The accessors are named almost exactly the same as the alpm_pkg_get... functions. I have removed the get_ prefix on the accessors. This is because you can't really set anything so you should know it's a get anyways.
alpm_pkg_get...
filename
name
version
desc
url
builddate
installdate
packager
arch
size
isize
reason
licenses
groups
depends
optdepends
conflicts
provides
deltas
replaces
files
backup
has_scriptlet
download_size
changelog
requiredby
optionalfor
db
checkmd5sum
origin
validation
signature
Attributes with plural names return an arrayref of strings. depends and files return an arrayref of hashrefs. db returns an ALPM::DB object.
This should be either "file", "localdb", or <"syncdb">. If this returns "unknown" something went wrong.
"file"
"localdb"
"unknown"
This returns a string which can either be "unknown", "none" or one or more of the following seperated by spaces: "MD5", "SHA", or "PGP".
"none"
"MD5"
"SHA"
"PGP"
Returns the package signature as a string encoded in Base64.
ALPM, ALPM::DB
Justin Davis, <juster at cpan dot org>
<juster at cpan dot org>
Copyright (C) 2013 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.
To install ALPM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ALPM
CPAN shell
perl -MCPAN -e shell install ALPM
For more information on module installation, please visit the detailed CPAN module installation guide.