From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

=head1 NAME
ALPM::Package - libalpm packages of files, with dependencies, etc.
=head1 SYNOPSIS
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 " @{$dep}{'name', 'mod', 'version'}\n";
}
## File lists are also arrayrefs of hashrefs (AoH):
print "$name owns files:\n";
for my $f (@{$perlpkg->files}){
print "\t%s %o %d", $f->{'name'}, $f->{'mode'}, $f->{'size'};
}
## Others lists are arrayrefs of scalars:
print "$name owns files:\n";
print " $_\n" foreach (@{$perlpkg->licenses});
=head1 DESCRIPTION
This class is a wrapper for all of the C<alpm_pkg_...> C library functions
of libalpm. You retrieve the package from the database and you can then
access its information.
=head1 ACCESSORS
The accessors are named I<(almost)> exactly the same as the
C<alpm_pkg_get...> functions. They are easy to use if you only want a
few attributes.
I have removed the get_ prefix on the accessors. This is because you
can't really I<set> anything so you should know it's a get anyways.
=over
=item * filename
=item * name
=item * version
=item * desc
=item * url
=item * builddate
=item * installdate
=item * packager
=item * arch
=item * size
=item * isize
=item * reason
=item * licenses
=item * groups
=item * depends
=item * optdepends
=item * conflicts
=item * provides
=item * deltas
=item * replaces
=item * files
=item * backup
=item * has_scriptlet
=item * download_size
=item * changelog
=item * requiredby
=item * db
=item * checkmd5sum
=back
Attributes with plural names return an arrayref of strings. I<depends> and I<files> return
an arrayref of hashrefs. I<db> returns an L<ALPM::DB> object.
=head1 SEE ALSO
L<ALPM>, L<ALPM::DB>
=head1 AUTHOR
Justin Davis, C<< <juster at cpan dot org> >>
=head1 COPYRIGHT AND LICENSE
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.
=cut