The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

#!/usr/bin/perl
use strict;
use Cwd;
BEGIN {
eval { require CPANPLUS::Dist::Arch; }
or die 'CPANPLUS::Dist::Arch must be installed for this script to work.'
}
my $cb = CPANPLUS::Backend->new;
my $destdir = getcwd;
MODULE_ARG:
while ( my $module = shift @ARGV ) {
my $modobj = $cb->module_tree( $module )
or next MODULE_ARG;
$modobj->install( target => 'create',
format => 'CPANPLUS::Dist::Arch',
verbose => 1,
pkg => 'src',
destdir => $destdir );
}
__END__
=head1 NAME
cpan2aur - Generate an AUR source package of a CPAN perl module
=head1 SYNOPSIS
$ ./cpan2aur Acme::Bleach
... spammy output from CPAN & makepkg here ...
$ ls *.src.tar.gz
perl-acme-bleach-1.12-1.src.tar.gz
$
=head1 DESCRIPTION
Example script for using the advanced options of
L<CPANPLUS::Dist::Arch>. Useful for updating AUR
perl modules you are maintaining.
Ironic how this is much more succinct then just creating a PKGBUILD...
=head1 AUTHOR
Justin Davis, C<< <jrcd83 at gmail.com> >>, juster on
=head1 COPYRIGHT & LICENSE
Copyright 2009 Justin Davis, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut