Alt-CPAN-Uploader-tinyua
view release on metacpan or search on metacpan
bin/cpan-upload view on Meta::CPAN
gpg -ea $HOME/.pause && mv $HOME/.pause{.asc,}
=head1 SEE ALSO
=over 4
=item L<CPAN::Uploader>
=item L<Config::Identity>
=back
=cut
my %arg;
# This nonsensical hack is to cope with Module::Install wanting to call
# cpan-upload -verbose; it should be made to use CPAN::Uploader instead.
$ARGV[0] = '--verbose' if @ARGV == 2 and $ARGV[0] eq '-verbose';
# Process arguments
my ($opt, $usage) = describe_options(
"usage: %c [options] file-to-upload",
[ "verbose|v" => "enable verbose logging" ],
[ "help|h" => "display this help message" ],
[ "dry-run" => "do not actually upload anything" ],
[],
[ "user|u=s" => "your PAUSE username" ],
[ "password|p=s" => "the password to your PAUSE account" ],
[ "directory|d=s" => "a dir in your CPAN space in which to put the files" ],
[ "http-proxy=s" => "URL of the http proxy to use in uploading" ],
[ "config|c=s" => "config file to use; defaults to ~/.pause" ],
);
if ($opt->help) {
print $usage->text;
exit;
}
my $from_file = CPAN::Uploader->read_config_file($opt->config);
die "Please provide at least one file name.\n" . $usage unless @ARGV;
$arg{user} = $opt->_specified('user') ? $opt->user : $from_file->{user};
die "Please provide a value for --user\n" unless defined $arg{user};
$arg{user} = uc $arg{user};
$arg{password} = $opt->password if $opt->_specified('password');
if (
! $arg{password}
and defined $from_file->{user}
and ($arg{user} eq uc $from_file->{user})
) {
$arg{password} = $from_file->{password};
}
$arg{debug} = 1 if $opt->verbose;
$arg{subdir} = $opt->directory if defined $opt->directory;
$arg{ $_ } = $opt->$_ for grep { defined $opt->$_ } qw(dry_run http_proxy);
if (! $arg{password}) {
require Term::ReadKey;
local $| = 1;
print "PAUSE Password: ";
Term::ReadKey::ReadMode('noecho');
chop($arg{password} = <STDIN>);
Term::ReadKey::ReadMode('restore');
print "\n";
}
foreach my $file (@ARGV) {
CPAN::Uploader->upload_file(
$file,
\%arg,
);
}
( run in 1.696 second using v1.01-cache-2.11-cpan-39bf76dae61 )