| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mojolicious::Command::Author::cpanify; |
|
2
|
1
|
|
|
1
|
|
8
|
use Mojo::Base 'Mojolicious::Command'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
10
|
use Mojo::File qw(path); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
54
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use Mojo::Util qw(getopt); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
443
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has description => 'Upload distribution to CPAN'; |
|
8
|
|
|
|
|
|
|
has usage => sub { shift->extract_usage }; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub run { |
|
11
|
2
|
|
|
2
|
1
|
908
|
my ($self, @args) = @_; |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
100
|
|
|
|
13
|
die $self->usage unless getopt \@args, |
|
14
|
|
|
|
|
|
|
'p|password=s' => \(my $password = ''), |
|
15
|
|
|
|
|
|
|
'u|user=s' => \(my $user = ''); |
|
16
|
1
|
50
|
|
|
|
6
|
die $self->usage unless my $file = shift @args; |
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
6
|
my $tx = $self->app->ua->tap(sub { $_->proxy->detect })->post( |
|
|
1
|
|
|
|
|
5
|
|
|
19
|
|
|
|
|
|
|
"https://$user:$password\@pause.perl.org/pause/authenquery" => form => { |
|
20
|
|
|
|
|
|
|
HIDDENNAME => $user, |
|
21
|
|
|
|
|
|
|
CAN_MULTIPART => 1, |
|
22
|
|
|
|
|
|
|
pause99_add_uri_upload => path($file)->basename, |
|
23
|
|
|
|
|
|
|
SUBMIT_pause99_add_uri_httpupload => ' Upload this file from my disk ', |
|
24
|
|
|
|
|
|
|
pause99_add_uri_uri => '', |
|
25
|
|
|
|
|
|
|
pause99_add_uri_httpupload => {file => $file}, |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
1
|
50
|
|
|
|
17
|
if (my $err = $tx->error) { |
|
30
|
0
|
|
0
|
|
|
0
|
my $code = $tx->res->code // 0; |
|
31
|
0
|
|
|
|
|
0
|
my $msg = $err->{message}; |
|
32
|
0
|
0
|
|
|
|
0
|
if ($code == 401) { $msg = 'Wrong username or password.' } |
|
|
0
|
0
|
|
|
|
0
|
|
|
33
|
0
|
|
|
|
|
0
|
elsif ($code == 409) { $msg = 'File already exists on CPAN.' } |
|
34
|
0
|
|
|
|
|
0
|
die qq{Problem uploading file "$file": $msg\n}; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
14
|
say 'Upload successful!'; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding utf8 |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Mojolicious::Command::Author::cpanify - CPAN-ify command |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Usage: APPLICATION cpanify [OPTIONS] [FILE] |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
mojo cpanify -u sri -p secr3t Mojolicious-Plugin-MyPlugin-0.01.tar.gz |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Options: |
|
55
|
|
|
|
|
|
|
-h, --help Show this summary of available options |
|
56
|
|
|
|
|
|
|
-p, --password PAUSE password |
|
57
|
|
|
|
|
|
|
-u, --user PAUSE username |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
L uploads files to CPAN. |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This is a core command, that means it is always enabled and its code a good example for learning to build new commands, |
|
64
|
|
|
|
|
|
|
you're welcome to fork it. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
See L for a list of commands that are available by default. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L inherits all attributes from L and implements the |
|
71
|
|
|
|
|
|
|
following new ones. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 description |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $description = $cpanify->description; |
|
76
|
|
|
|
|
|
|
$cpanify = $cpanify->description('Foo'); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Short description of this command, used for the command list. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 usage |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
my $usage = $cpanify->usage; |
|
83
|
|
|
|
|
|
|
$cpanify = $cpanify->usage('Foo'); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Usage information for this command, used for the help screen. |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 METHODS |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L inherits all methods from L and implements the following |
|
90
|
|
|
|
|
|
|
new ones. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 run |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$cpanify->run(@ARGV); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Run this command. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L, L, L. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |