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

#!/usr/bin/perl
use strict;
use Cwd;
eval { require CPANPLUS::Dist::Arch; }
or die "error: CPANPLUS::Dist::Arch must be installed for this script to work.\n";
my $cb = CPANPLUS::Backend->new;
my @modnames = grep { /\A[\w:]+\z/ } @ARGV;
pod2usage() unless ( @modnames );
MODULE_ARG:
for my $modname ( @modnames ) {
my $modobj = $cb->module_tree( $modname )
or next MODULE_ARG;
$modobj->install( target => 'create',
format => 'CPANPLUS::Dist::Arch',
verbose => 1,
pkg => 'src',
destdir => getcwd() );
}
__END__
=head1 NAME
cpan2aur - Generate an AUR source package of a CPAN perl module
=head1 SYNOPSIS
cpan2aur Module::Name [ ... Module::Name ]
=head1 DESCRIPTION
Example script for using the advanced options of
L<CPANPLUS::Dist::Arch>. Creates a source package in the current
working directory of each module passed as arguments.
=head1 AUTHOR
Justin Davis, C<< <jrcd83 at gmail dot 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