WWW::AUR::Package - Query, download, and build AUR packages.
use WWW::AUR; my $aurobj = WWW::AUR->new(); my $pkg = $aurobj->find( 'perl-www-aur' ); # or using WWW::AUR::Package directly ... use WWW::AUR::Package; my $pkg = WWW::AUR::Package->new( 'perl-www-aur' ); #---------------------------------------------------------------------- # Accessors exist for package info fields... printf "ID: %d -- Name: %s -- Version: %s\n", $pkg->id, $pkg->name, $pkg->version; # Or retrieve the info as a hash, easier for printing... my %info = $pkg->info; print "ID: $info{id} -- Name: $info{name} -- Version: $info{version}" # Before extracting, pkgbuild() gets the PKGBUILD from the webpage... my %pkgbuild = $pkg->pkgbuild; print "pkgname: $pkgbuild{pkgname}\npkgver: $pkgbuild{pkgver}\n"; #---------------------------------------------------------------------- # Check the source package file size before downloading... my $dlsize = $pkg->download_size; print "Source package size is $dlsize bytes.\n"; # PKGBUILD arrays are turned into array refs... printf "depends: %s\n", join q{ }, @{ $pkgbuild{depends} }; # download() method sets the src_pkg_path() accessor... $pkg->download; print "Downloaded %s to %s.\n", $pkg->name, $pkg->src_pkg_path; # extract() method sets the src_dir_path() accessor... $pkg->extract; print "Extracted source package to %s.\n", $pkg->src_dir_path; # build() method sets the bin_pkg_path() accessor... $pkg->build; print "Build binary package and saved to %s.\n", $pkg->bin_pkg_path(); # After extracting, pkgbuild() is read from the file on disk... %pkgbuild = $pkg->pkgbuild; # Get the package owner maintainer object... my $maint_obj = $pkg->maintainer();
The package class is the most important class for the WWW::AUR package. Using a package object, you can lookup any information you need for the package as well as download, extract, and build the package with the makepkg command.
$OBJ = WWW::AUR::Package->new( $NAME, %PATH_PARAMS );
The constructor takes the package name as its argument. An error will be croaked with Carp if the package could not be found on the AUR. Path parameters are optional, see "PATH PARAMETERS" in WWW::AUR for more information.
$NAME
The name of the AUR package.
%PATH_PARAMS
Optional path parameters. See "PATH PARAMETERS" in WWW::AUR.
This error is croaked if the package with the given $NAME could not be found.
$IDNUM = $OBJ->id; (RPC Field Names) $NAME = $OBJ->name; $VERSION = $OBJ->version; $DESC = $OBJ->desc; ("Description") $CATEGORY = $OBJ->category; $LOCID = $OBJ->locationid; $URL = $OBJ->url; $URLPATH = $OBJ->urlpath; $LICENSE = $OBJ->license; $VOTES = $OBJ->votes; ("NumVotes") $OUTDATED = $OBJ->outdated; ("OutOfDate")
These accessors correlate exactly to the keys returned to by the AUR's rpc.php output given. Most of the fields are self explanatory.
$CATEGORY
Instead of using an id number for categories, they are mapped to the name of the category. The following names are used for each corresponding category ID:
$VOTES
The NumVotes RPC field was renamed to, simply, votes.
$OUTDATED
The OutOfDate RPC field was renamed to outdated.
%PKGBUILD = $OBJ->pkgbuild;
Parses the PKGBUILD file and returns it as a hash, converting all bash arrays to array references. The hash key names are identical to the PKGBUILD variable names. See PKGBUILD(5).
If the package has already been extracted (see "extract") then the PKGBUILD is read from the PKGBUILD file extracted to disk. Otherwise, the PKGBUILD is read direct from the AUR webpage without downloading a source package file.
$SRCPKGPATH = $OBJ->download( $CALLBACK? )
$CALLBACK
A code reference that will be called everytime a "chunk" of data is downloaded. Two parameters are passed to the supplied code reference:
$SRCPKGPATH
The absolute path to the source package file that was downloaded.
$SRCPKGDIR = $OBJ->extract;
$SRCPKGDIR
The absolute path to the directory where the source package was extracted. (This is the directory that is contained in the source package file, extracted)
$BINPKGDIR = $OBJ->build( %BUILD_PARAMS? );
Builds the AUR package, using the makepkg utility.
%BUILD_PARMAS
Path parameters can be mixed with build parameters. Several build parameters can be used to provide arguments to makepkg.
Build parameter keys:
Overrides where to store the built binary package file.
If set to a true value the makepkg output is redirected to /dev/null.
A string to prefix before the makepkg command.
A string to append to the makepkg command as arguments.
$BINPKGDIR
The absolute path to the binary package that was created by running makepkg.
undef | $PATH = $OBJ->src_pkg_path;
If download has been called, then the path of the downloaded source package file is returned. Otherwise undef is returned.
undef
undef | $PATH = $OBJ->src_pkg_dir;
If extract has been called, then the path of the extract source package dir is returned. Otherwise undef is returned.
undef | $PATH = $OBJ->bin_pkg_path;
If build has been called, then the path of the built binary package is returned. Otherwise undef is returned.
WWW::AUR
makepkg(8)
Justin Davis, <juster at cpan dot org>
<juster at cpan dot org>
Please report any bugs or feature requests to bug-www-aur at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-AUR. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-aur at rt.cpan.org
Send me an email at the above address if you have any questions or need help.
Copyright 2010 Justin Davis.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install WWW::AUR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::AUR
CPAN shell
perl -MCPAN -e shell install WWW::AUR
For more information on module installation, please visit the detailed CPAN module installation guide.