line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Mini::Inject; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
241235
|
use strict; |
|
13
|
|
|
|
|
36
|
|
|
13
|
|
|
|
|
371
|
|
4
|
13
|
|
|
13
|
|
66
|
use warnings; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
573
|
|
5
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
5743
|
use CPAN::Checksums qw( updatedir ); |
|
13
|
|
|
|
|
1188055
|
|
|
13
|
|
|
|
|
757
|
|
7
|
13
|
|
|
13
|
|
6128
|
use CPAN::Mini; |
|
13
|
|
|
|
|
582424
|
|
|
13
|
|
|
|
|
426
|
|
8
|
13
|
|
|
13
|
|
5594
|
use CPAN::Mini::Inject::Config; |
|
13
|
|
|
|
|
77
|
|
|
13
|
|
|
|
|
315
|
|
9
|
13
|
|
|
13
|
|
78
|
use Carp; |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
563
|
|
10
|
13
|
|
|
13
|
|
68
|
use Compress::Zlib; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
3157
|
|
11
|
13
|
|
|
13
|
|
9383
|
use Env; |
|
13
|
|
|
|
|
24743
|
|
|
13
|
|
|
|
|
69
|
|
12
|
13
|
|
|
13
|
|
6849
|
use File::Basename; |
|
13
|
|
|
|
|
33
|
|
|
13
|
|
|
|
|
844
|
|
13
|
13
|
|
|
13
|
|
76
|
use File::Copy; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
601
|
|
14
|
13
|
|
|
13
|
|
79
|
use File::Path qw( make_path ); |
|
13
|
|
|
|
|
29
|
|
|
13
|
|
|
|
|
477
|
|
15
|
13
|
|
|
13
|
|
65
|
use File::Spec; |
|
13
|
|
|
|
|
26
|
|
|
13
|
|
|
|
|
265
|
|
16
|
13
|
|
|
13
|
|
5113
|
use LWP::Simple; |
|
13
|
|
|
|
|
182956
|
|
|
13
|
|
|
|
|
97
|
|
17
|
13
|
|
|
13
|
|
8922
|
use Dist::Metadata (); |
|
13
|
|
|
|
|
321748
|
|
|
13
|
|
|
|
|
2844
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
CPAN::Mini::Inject - Inject modules into a CPAN::Mini mirror. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 VERSION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Version 0.34 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = '0.34'; |
30
|
|
|
|
|
|
|
our @ISA = qw( CPAN::Mini ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 Synopsis |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
If you're not going to customize the way CPAN::Mini::Inject works you |
35
|
|
|
|
|
|
|
probably want to look at the L command instead. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
use CPAN::Mini::Inject; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$mcpi=CPAN::Mini::Inject->new; |
40
|
|
|
|
|
|
|
$mcpi->parsecfg('t/.mcpani/config'); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
$mcpi->add( module => 'CPAN::Mini::Inject', |
43
|
|
|
|
|
|
|
authorid => 'SSORICHE', |
44
|
|
|
|
|
|
|
version => ' 0.01', |
45
|
|
|
|
|
|
|
file => 'mymodules/CPAN-Mini-Inject-0.01.tar.gz' ) |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$mcpi->writelist; |
48
|
|
|
|
|
|
|
$mcpi->update_mirror; |
49
|
|
|
|
|
|
|
$mcpi->inject; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
CPAN::Mini::Inject uses CPAN::Mini to build or update a local CPAN mirror |
54
|
|
|
|
|
|
|
then adds modules from your repository to it, allowing the inclusion |
55
|
|
|
|
|
|
|
of private modules in a minimal CPAN mirror. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Each method in CPAN::Mini::Inject returns a CPAN::Mini::Inject object which |
60
|
|
|
|
|
|
|
allows method chaining. For example: |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $mcpi=CPAN::Mini::Inject->new; |
63
|
|
|
|
|
|
|
$mcpi->parsecfg |
64
|
|
|
|
|
|
|
->update_mirror |
65
|
|
|
|
|
|
|
->inject; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
A C ISA L. Refer to the |
68
|
|
|
|
|
|
|
L for that module for details of the interface |
69
|
|
|
|
|
|
|
C inherits from it. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 C |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Create a new CPAN::Mini::Inject object. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub new { |
78
|
17
|
|
|
17
|
1
|
2014563
|
return bless |
79
|
|
|
|
|
|
|
{ config_class => 'CPAN::Mini::Inject::Config' }, |
80
|
|
|
|
|
|
|
$_[0]; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 C<< config_class( [CLASS] ) >> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns the name of the class handling the configuration. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
With an argument, it sets the name of the class to handle |
88
|
|
|
|
|
|
|
the config. To use that, you'll have to call it before you |
89
|
|
|
|
|
|
|
load the configuration. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub config_class { |
94
|
16
|
|
|
16
|
1
|
44
|
my $self = shift; |
95
|
|
|
|
|
|
|
|
96
|
16
|
50
|
|
|
|
66
|
if ( @_ ) { $self->{config_class} = shift } |
|
0
|
|
|
|
|
0
|
|
97
|
|
|
|
|
|
|
|
98
|
16
|
|
|
|
|
189
|
$self->{config_class}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 C<< config >> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Returns the configuration object. This object should be from |
104
|
|
|
|
|
|
|
the class returned by C unless you've done something |
105
|
|
|
|
|
|
|
weird. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub config { |
110
|
146
|
|
|
146
|
1
|
290
|
my $self = shift; |
111
|
|
|
|
|
|
|
|
112
|
146
|
100
|
|
|
|
390
|
if ( @_ ) { $self->{config} = shift } |
|
6
|
|
|
|
|
24
|
|
113
|
|
|
|
|
|
|
|
114
|
146
|
|
|
|
|
674
|
$self->{config}; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 C<< loadcfg( [FILENAME] ) >> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This is a bridge to CPAN::Mini::Inject::Config's loadconfig. It sets the |
121
|
|
|
|
|
|
|
filename for the configuration, or uses one of the defaults. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub loadcfg { |
126
|
13
|
|
|
13
|
1
|
1042
|
my $self = shift; |
127
|
|
|
|
|
|
|
|
128
|
13
|
100
|
|
|
|
119
|
unless ( $self->{config} ) { |
129
|
10
|
|
|
|
|
76
|
$self->{config} = $self->config_class->new; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
13
|
|
|
|
|
92
|
$self->{cfgfile} = $self->{config}->load_config( @_ ); |
133
|
|
|
|
|
|
|
|
134
|
12
|
|
|
|
|
46
|
return $self; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 C<< parsecfg() >> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is a bridge to CPAN::Mini::Inject::Config's parseconfig. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub parsecfg { |
144
|
15
|
|
|
15
|
1
|
119
|
my $self = shift; |
145
|
|
|
|
|
|
|
|
146
|
15
|
100
|
|
|
|
405
|
unless ( $self->{config} ) { |
147
|
6
|
|
|
|
|
42
|
$self->config( $self->config_class->new ); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
15
|
|
|
|
|
59
|
$self->config->parse_config( @_ ); |
151
|
|
|
|
|
|
|
|
152
|
14
|
|
|
|
|
47
|
return $self; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 C<< site( [SITE] ) >> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Returns the CPAN site that CPAN::Mini::Inject chose from the |
158
|
|
|
|
|
|
|
list specified in the C directive. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub site { |
163
|
13
|
|
|
13
|
|
131
|
no warnings; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
29208
|
|
164
|
8
|
|
|
8
|
1
|
16
|
my $self = shift; |
165
|
|
|
|
|
|
|
|
166
|
8
|
100
|
|
|
|
26
|
if ( @_ ) { $self->{site} = shift } |
|
3
|
|
|
|
|
8
|
|
167
|
|
|
|
|
|
|
|
168
|
8
|
100
|
|
|
|
70
|
$self->{site} || ''; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 C |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Test each site listed in the remote parameter of the config file by performing |
174
|
|
|
|
|
|
|
a get on each site in order for authors/01mailrc.txt.gz. The first site to |
175
|
|
|
|
|
|
|
respond successfully is set as the instance variable site. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
print "$mcpi->{site}\n"; # ftp://ftp.cpan.org/pub/CPAN |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
C accepts an optional parameter to enable verbose mode. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
sub testremote { |
184
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
185
|
2
|
|
|
|
|
5
|
my $verbose = shift; |
186
|
|
|
|
|
|
|
|
187
|
2
|
100
|
|
|
|
7
|
$self->site( undef ) if $self->site; |
188
|
|
|
|
|
|
|
|
189
|
2
|
50
|
|
|
|
7
|
$ENV{FTP_PASSIVE} = 1 if ( $self->config->get( 'passive' ) ); |
190
|
|
|
|
|
|
|
|
191
|
2
|
|
|
|
|
10
|
for my $site ( split( /\s+/, $self->config->get( 'remote' ) ) ) { |
192
|
|
|
|
|
|
|
|
193
|
3
|
50
|
|
|
|
9598
|
$site .= '/' unless ( $site =~ m/\/$/ ); |
194
|
|
|
|
|
|
|
|
195
|
3
|
50
|
|
|
|
9
|
print "Testing site: $site\n" if ( $verbose ); |
196
|
|
|
|
|
|
|
|
197
|
3
|
100
|
|
|
|
25
|
if ( get( $site . 'authors/01mailrc.txt.gz' ) ) { |
198
|
2
|
|
|
|
|
75739
|
$self->site( $site ); |
199
|
|
|
|
|
|
|
|
200
|
2
|
50
|
|
|
|
6
|
print "\n$site selected.\n" if ( $verbose ); |
201
|
2
|
|
|
|
|
5
|
last; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
2
|
50
|
|
|
|
8
|
croak "Unable to connect to any remote site" unless $self->site; |
206
|
|
|
|
|
|
|
|
207
|
2
|
|
|
|
|
7
|
return $self; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=head2 C |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
This is a subclass of CPAN::Mini. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=cut |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub update_mirror { |
217
|
1
|
|
|
1
|
1
|
169
|
my $self = shift; |
218
|
1
|
|
|
|
|
15
|
my %options = @_; |
219
|
|
|
|
|
|
|
|
220
|
1
|
50
|
|
|
|
7
|
croak 'Can not write to local: ' . $self->config->get( 'local' ) |
221
|
|
|
|
|
|
|
unless ( -w $self->config->get( 'local' ) ); |
222
|
|
|
|
|
|
|
|
223
|
1
|
50
|
|
|
|
6
|
$ENV{FTP_PASSIVE} = 1 if $self->config->get( 'passive' ); |
224
|
|
|
|
|
|
|
|
225
|
1
|
|
33
|
|
|
17
|
$options{local} ||= $self->config->get( 'local' ); |
226
|
1
|
|
50
|
|
|
24
|
$options{trace} ||= 0; |
227
|
1
|
|
50
|
|
|
22
|
$options{skip_perl} ||= $self->config->get( 'perl' ) || 1; |
|
|
|
33
|
|
|
|
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
$self->testremote( $options{trace} ) |
230
|
1
|
50
|
33
|
|
|
12
|
unless ( $self->site || $options{remote} ); |
231
|
1
|
|
33
|
|
|
8
|
$options{remote} ||= $self->site; |
232
|
|
|
|
|
|
|
|
233
|
1
|
|
33
|
|
|
10
|
$options{dirmode} ||= oct( $self->config->get( 'dirmode' ) |
|
|
|
33
|
|
|
|
|
234
|
|
|
|
|
|
|
|| sprintf( '0%o', 0777 & ~umask ) ); |
235
|
|
|
|
|
|
|
|
236
|
1
|
|
|
|
|
40
|
CPAN::Mini->update_mirror( %options ); |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 C |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Add a new module to the repository. The add method copies the module |
242
|
|
|
|
|
|
|
file into the repository with the same structure as a CPAN site. For |
243
|
|
|
|
|
|
|
example CPAN-Mini-Inject-0.01.tar.gz is copied to |
244
|
|
|
|
|
|
|
MYCPAN/authors/id/S/SS/SSORICHE. add creates the required directory |
245
|
|
|
|
|
|
|
structure below the repository. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Packages found in the distribution will be added to the module list |
248
|
|
|
|
|
|
|
(for example both C and C |
249
|
|
|
|
|
|
|
will be added to the F file). |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
Packages will be looked for in the C key of the META file if present, |
252
|
|
|
|
|
|
|
otherwise the files in the dist will be searched. |
253
|
|
|
|
|
|
|
See L for more information. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=over 4 |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=item * module |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
The name of the module to add. |
260
|
|
|
|
|
|
|
The distribution file will be searched for modules |
261
|
|
|
|
|
|
|
but you can specify the main one explicitly. |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=item * authorid |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
CPAN author id. This does not have to be a real author id. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item * version |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
The modules version number. |
270
|
|
|
|
|
|
|
Module names and versions will be determined, |
271
|
|
|
|
|
|
|
but you can specify one explicitly. |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=item * file |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
The tar.gz of the module. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=back |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=head3 Example |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
add( module => 'Module::Name', |
282
|
|
|
|
|
|
|
authorid => 'AUTHOR', |
283
|
|
|
|
|
|
|
version => 0.01, |
284
|
|
|
|
|
|
|
file => './Module-Name-0.01.tar.gz' ); |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=cut |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
sub add { |
289
|
15
|
|
|
15
|
1
|
3292
|
my $self = shift; |
290
|
15
|
|
|
|
|
71
|
my %options = @_; |
291
|
|
|
|
|
|
|
|
292
|
15
|
|
|
|
|
58
|
my $optionchk |
293
|
|
|
|
|
|
|
= _optionchk( \%options, qw/authorid file/ ); |
294
|
|
|
|
|
|
|
|
295
|
15
|
100
|
|
|
|
62
|
croak "Required option not specified: $optionchk" if $optionchk; |
296
|
14
|
100
|
|
|
|
38
|
croak "No repository configured" |
297
|
|
|
|
|
|
|
unless ( $self->config->get( 'repository' ) ); |
298
|
13
|
50
|
|
|
|
36
|
croak "Can not write to repository: " |
299
|
|
|
|
|
|
|
. $self->config->get( 'repository' ) |
300
|
|
|
|
|
|
|
unless ( -w $self->config->get( 'repository' ) ); |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
croak "Can not read module file: $options{file}" |
303
|
13
|
100
|
|
|
|
189
|
unless -r $options{file}; |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# attempt to guess module and version |
306
|
12
|
|
|
|
|
109
|
my $distmeta = Dist::Metadata->new( file => $options{file} ); |
307
|
12
|
|
|
|
|
399
|
my $packages = $distmeta->package_versions; |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
# include passed in module and version (prefer discovered version) |
310
|
12
|
100
|
|
|
|
486247
|
if ( $options{module} ) { |
311
|
8
|
|
66
|
|
|
66
|
$packages->{ $options{module} } ||= $options{version}; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
# if no packages were found we need explicit options |
315
|
12
|
100
|
|
|
|
57
|
if ( !keys %$packages ) { |
316
|
1
|
|
|
|
|
8
|
$optionchk |
317
|
|
|
|
|
|
|
= _optionchk( \%options, qw/module version/ ); |
318
|
|
|
|
|
|
|
|
319
|
1
|
50
|
|
|
|
32
|
croak "Required option not specified and no modules were found: $optionchk" |
320
|
|
|
|
|
|
|
if $optionchk; |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
11
|
|
|
|
|
522
|
my $modulefile = basename( $options{file} ); |
324
|
11
|
100
|
|
|
|
74
|
$self->readlist unless exists( $self->{modulelist} ); |
325
|
|
|
|
|
|
|
|
326
|
11
|
|
|
|
|
49
|
$options{authorid} = uc( $options{authorid} ); |
327
|
|
|
|
|
|
|
$self->{authdir} = $self->_authordir( $options{authorid}, |
328
|
11
|
|
|
|
|
53
|
$self->config->get( 'repository' ) ); |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
my $target |
331
|
|
|
|
|
|
|
= $self->config->get( 'repository' ) |
332
|
|
|
|
|
|
|
. '/authors/id/' |
333
|
|
|
|
|
|
|
. $self->{authdir} . '/' |
334
|
11
|
|
|
|
|
40
|
. basename( $options{file} ); |
335
|
|
|
|
|
|
|
|
336
|
11
|
50
|
|
|
|
347
|
copy( $options{file}, dirname( $target ) ) |
337
|
|
|
|
|
|
|
or croak "Copy failed: $!"; |
338
|
|
|
|
|
|
|
|
339
|
11
|
|
|
|
|
4288
|
$self->_updperms( $target ); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
{ |
342
|
11
|
|
|
|
|
90
|
my $mods = join('|', keys %$packages); |
|
11
|
|
|
|
|
71
|
|
343
|
|
|
|
|
|
|
# remove old versions from the list |
344
|
11
|
|
|
|
|
41
|
@{ $self->{modulelist} } |
345
|
11
|
|
|
|
|
28
|
= grep { $_ !~ m/\A($mods)\s+/ } @{ $self->{modulelist} }; |
|
11
|
|
|
|
|
277
|
|
|
11
|
|
|
|
|
33
|
|
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
# make data available afterwards (since method returns $self) |
349
|
11
|
|
100
|
|
|
91
|
push @{ $self->{added_modules} ||= [] }, |
350
|
11
|
|
|
|
|
26
|
{ file => $modulefile, authorid => $options{authorid}, modules => $packages }; |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
push( |
353
|
11
|
|
|
|
|
35
|
@{ $self->{modulelist} }, |
354
|
|
|
|
|
|
|
map { |
355
|
11
|
|
|
|
|
24
|
_fmtmodule( |
356
|
|
|
|
|
|
|
$_, File::Spec::Unix->catfile( File::Spec->splitdir( $self->{authdir} ), $modulefile ), |
357
|
13
|
50
|
|
|
|
229
|
defined($packages->{$_}) ? $packages->{$_} : 'undef' |
358
|
|
|
|
|
|
|
) |
359
|
|
|
|
|
|
|
} keys %$packages |
360
|
|
|
|
|
|
|
); |
361
|
|
|
|
|
|
|
|
362
|
11
|
|
|
|
|
452
|
return $self; |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=head2 C |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
Returns a list of hash references describing the modules added by this instance. |
368
|
|
|
|
|
|
|
Each hashref will contain C, C, and C. |
369
|
|
|
|
|
|
|
The C entry is a hashref of module names and versions included in the C. |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
The list is cumulative. |
372
|
|
|
|
|
|
|
There will be one entry for each time L was called. |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
This functionality is mostly provided for the included L script |
375
|
|
|
|
|
|
|
to be able to verbosely print all the modules added. |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=cut |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
sub added_modules { |
380
|
1
|
|
|
1
|
1
|
5089
|
my $self = shift; |
381
|
1
|
|
50
|
|
|
3
|
return @{ $self->{added_modules} ||= [] }; |
|
1
|
|
|
|
|
23
|
|
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
=head2 C |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
Insert modules from the repository into the local CPAN::Mini mirror. inject |
387
|
|
|
|
|
|
|
copies each module into the appropriate directory in the CPAN::Mini mirror |
388
|
|
|
|
|
|
|
and updates the CHECKSUMS file. |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
Passing a value to C enables verbose mode, which lists each module |
391
|
|
|
|
|
|
|
as it's injected. |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=cut |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
sub inject { |
396
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
397
|
1
|
|
|
|
|
3
|
my $verbose = shift; |
398
|
|
|
|
|
|
|
|
399
|
1
|
50
|
|
|
|
4
|
my $dirmode = oct( $self->config->get( 'dirmode' ) ) |
400
|
|
|
|
|
|
|
if ( $self->config->get( 'dirmode' ) ); |
401
|
|
|
|
|
|
|
|
402
|
1
|
50
|
|
|
|
4
|
$self->readlist unless ( exists( $self->{modulelist} ) ); |
403
|
|
|
|
|
|
|
|
404
|
1
|
|
|
|
|
3
|
my %updatedir; |
405
|
|
|
|
|
|
|
my %already_injected; |
406
|
1
|
|
|
|
|
3
|
for my $modline ( @{ $self->{modulelist} } ) { |
|
1
|
|
|
|
|
3
|
|
407
|
2
|
|
|
|
|
15
|
my ( $module, $version, $file ) = split( /\s+/, $modline ); |
408
|
|
|
|
|
|
|
|
409
|
2
|
50
|
|
|
|
8
|
next if $already_injected{$file}++; |
410
|
|
|
|
|
|
|
|
411
|
2
|
|
|
|
|
4
|
my $target = $self->config->get( 'local' ) . '/authors/id/' . $file; |
412
|
2
|
|
|
|
|
6
|
my $source |
413
|
|
|
|
|
|
|
= $self->config->get( 'repository' ) . '/authors/id/' . $file; |
414
|
|
|
|
|
|
|
|
415
|
2
|
|
|
|
|
43
|
$updatedir{ dirname( $file ) } = 1; |
416
|
|
|
|
|
|
|
|
417
|
2
|
|
|
|
|
31
|
my $tdir = dirname $target; |
418
|
2
|
50
|
|
|
|
11
|
_make_path( $tdir, defined $dirmode ? { mode => $dirmode } : {} ); |
419
|
2
|
50
|
|
|
|
10
|
copy( $source, $tdir ) |
420
|
|
|
|
|
|
|
or croak "Copy $source to $tdir failed: $!"; |
421
|
|
|
|
|
|
|
|
422
|
2
|
|
|
|
|
499
|
$self->_updperms( $target ); |
423
|
2
|
50
|
|
|
|
9
|
print "$target ... injected $module\n" if $verbose; |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
|
426
|
1
|
|
|
|
|
5
|
for my $dir ( keys( %updatedir ) ) { |
427
|
2
|
|
|
|
|
24
|
my $authdir = $self->config->get( 'local' ) . "/authors/id/$dir"; |
428
|
|
|
|
|
|
|
|
429
|
2
|
|
|
|
|
14
|
updatedir( $authdir ); |
430
|
2
|
|
|
|
|
58910
|
$self->_updperms( "$authdir/CHECKSUMS" ); |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
|
433
|
1
|
|
|
|
|
7
|
$self->updpackages; |
434
|
1
|
|
|
|
|
337
|
$self->updauthors; |
435
|
|
|
|
|
|
|
|
436
|
1
|
|
|
|
|
242
|
return $self; |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=head2 C |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
Update the CPAN::Mini mirror's modules/02packages.details.txt.gz with the |
442
|
|
|
|
|
|
|
injected module information. |
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=cut |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
sub updpackages { |
447
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
448
|
|
|
|
|
|
|
|
449
|
1
|
|
|
|
|
2
|
my @modules = sort( @{ $self->{modulelist} } ); |
|
1
|
|
|
|
|
7
|
|
450
|
1
|
|
|
|
|
5
|
my $infile = $self->_readpkgs; |
451
|
1
|
|
|
|
|
32
|
my %packages; |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
# These need to be unique-per-package, with ones that come from the input |
454
|
|
|
|
|
|
|
# file being overridden. |
455
|
1
|
|
|
|
|
4
|
for my $line (@$infile, @modules) { |
456
|
8
|
|
|
|
|
22
|
my ($pkg) = split(/\s+/, $line, 2); |
457
|
8
|
|
|
|
|
20
|
$packages{$pkg} = $line; |
458
|
|
|
|
|
|
|
}; |
459
|
|
|
|
|
|
|
|
460
|
1
|
|
|
|
|
7
|
$self->_writepkgs( [ sort { lc $a cmp lc $b } values %packages ] ); |
|
13
|
|
|
|
|
28
|
|
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=head2 C |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
Update the CPAN::Mini mirror's authors/01mailrc.txt.gz with |
466
|
|
|
|
|
|
|
stub information should the author not actually exist on CPAN |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
=cut |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
sub updauthors { |
471
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
472
|
|
|
|
|
|
|
|
473
|
1
|
|
|
|
|
12
|
my $repo_authors = $self->_readauthors; |
474
|
|
|
|
|
|
|
my %author_ids_in_repo = map { |
475
|
1
|
|
|
|
|
32
|
my ( $id ) = $_ =~ /alias \s+ (\S+)/xms; |
|
4
|
|
|
|
|
18
|
|
476
|
4
|
|
|
|
|
11
|
$id => 1; |
477
|
|
|
|
|
|
|
} @$repo_authors; |
478
|
|
|
|
|
|
|
|
479
|
1
|
|
|
|
|
3
|
my @authors; |
480
|
|
|
|
|
|
|
my %authors_added; |
481
|
|
|
|
|
|
|
AUTHOR: |
482
|
1
|
|
|
|
|
2
|
for my $modline ( @{ $self->{modulelist} } ) { |
|
1
|
|
|
|
|
4
|
|
483
|
2
|
|
|
|
|
11
|
my ( $module, $version, $file ) = split( /\s+/, $modline ); |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
# extract the author from the path |
486
|
2
|
|
|
|
|
18
|
my @dirs = File::Spec->splitdir( $file ); |
487
|
2
|
|
|
|
|
3
|
my $author = $dirs[2]; |
488
|
|
|
|
|
|
|
|
489
|
2
|
50
|
|
|
|
8
|
next AUTHOR if defined $author_ids_in_repo{$author}; |
490
|
2
|
50
|
|
|
|
6
|
next AUTHOR if defined $authors_added{$author}; |
491
|
|
|
|
|
|
|
|
492
|
2
|
|
|
|
|
9
|
push @$repo_authors, |
493
|
|
|
|
|
|
|
sprintf( 'alias %-10s "Custom Non-CPAN author "', |
494
|
|
|
|
|
|
|
$author ); |
495
|
2
|
|
|
|
|
8
|
$authors_added{$author} = 1; |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
|
498
|
1
|
|
|
|
|
6
|
$self->_writeauthors( $repo_authors ); |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
} |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=head2 C |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
Load the repository's modulelist. |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
=cut |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
sub _repo_file { |
509
|
7
|
|
|
7
|
|
29
|
File::Spec->catfile( shift->config->get( 'repository' ), @_ ); |
510
|
|
|
|
|
|
|
} |
511
|
|
|
|
|
|
|
|
512
|
7
|
|
|
7
|
|
31
|
sub _modulelist { shift->_repo_file( 'modulelist' ) } |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
sub readlist { |
515
|
7
|
|
|
7
|
1
|
18
|
my $self = shift; |
516
|
|
|
|
|
|
|
|
517
|
7
|
|
|
|
|
23
|
$self->{modulelist} = undef; |
518
|
|
|
|
|
|
|
|
519
|
7
|
|
|
|
|
27
|
my $ml = $self->_modulelist; |
520
|
7
|
100
|
|
|
|
232
|
return $self unless -e $ml; |
521
|
|
|
|
|
|
|
|
522
|
2
|
50
|
|
|
|
40
|
open MODLIST, '<', $ml or croak "Can not read module list: $ml ($!)"; |
523
|
2
|
|
|
|
|
25
|
while ( ) { |
524
|
6
|
|
|
|
|
16
|
chomp; |
525
|
6
|
|
|
|
|
11
|
push @{ $self->{modulelist} }, $_; |
|
6
|
|
|
|
|
28
|
|
526
|
|
|
|
|
|
|
} |
527
|
2
|
|
|
|
|
13
|
close MODLIST; |
528
|
|
|
|
|
|
|
|
529
|
2
|
|
|
|
|
7
|
return $self; |
530
|
|
|
|
|
|
|
} |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=head2 C |
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
Write to the repository modulelist. |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=cut |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
sub writelist { |
539
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
croak 'Can not write module list: ' |
542
|
|
|
|
|
|
|
. $self->config->get( 'repository' ) |
543
|
|
|
|
|
|
|
. "/modulelist ERROR: $!" |
544
|
|
|
|
|
|
|
unless ( -w $self->{config}{repository} . '/modulelist' |
545
|
2
|
50
|
66
|
|
|
50
|
|| -w $self->{config}{repository} ); |
546
|
2
|
50
|
|
|
|
10
|
return $self unless defined( $self->{modulelist} ); |
547
|
|
|
|
|
|
|
|
548
|
2
|
|
|
|
|
8
|
open( MODLIST, |
549
|
|
|
|
|
|
|
'>' . $self->config->get( 'repository' ) . '/modulelist' ); |
550
|
2
|
|
|
|
|
11
|
for ( sort( @{ $self->{modulelist} } ) ) { |
|
2
|
|
|
|
|
16
|
|
551
|
6
|
|
|
|
|
19
|
chomp; |
552
|
6
|
|
|
|
|
37
|
print MODLIST "$_\n"; |
553
|
|
|
|
|
|
|
} |
554
|
2
|
|
|
|
|
72
|
close( MODLIST ); |
555
|
|
|
|
|
|
|
|
556
|
2
|
|
|
|
|
13
|
$self->_updperms( |
557
|
|
|
|
|
|
|
$self->config->get( 'repository' ) . '/modulelist' ); |
558
|
|
|
|
|
|
|
|
559
|
2
|
|
|
|
|
12
|
return $self; |
560
|
|
|
|
|
|
|
} |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
sub _updperms { |
563
|
17
|
|
|
17
|
|
57
|
my ( $self, $file ) = @_; |
564
|
|
|
|
|
|
|
|
565
|
17
|
50
|
|
|
|
55
|
chmod oct( $self->config->get( 'dirmode' ) ) & 06666, $file |
566
|
|
|
|
|
|
|
if $self->config->get( 'dirmode' ); |
567
|
|
|
|
|
|
|
} |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
sub _optionchk { |
570
|
16
|
|
|
16
|
|
58
|
my ( $options, @list ) = @_; |
571
|
16
|
|
|
|
|
32
|
my @missing; |
572
|
|
|
|
|
|
|
|
573
|
16
|
|
|
|
|
43
|
for my $option ( @list ) { |
574
|
|
|
|
|
|
|
push @missing, $option |
575
|
32
|
100
|
|
|
|
99
|
unless defined $$options{$option}; |
576
|
|
|
|
|
|
|
} |
577
|
|
|
|
|
|
|
|
578
|
16
|
|
|
|
|
62
|
return join ' ', @missing; |
579
|
|
|
|
|
|
|
} |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
sub _make_path { |
582
|
13
|
|
|
13
|
|
50
|
my $um = umask 0; |
583
|
13
|
|
|
|
|
3536
|
make_path( @_ ); |
584
|
13
|
|
|
|
|
59
|
umask $um; |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
sub _authordir { |
588
|
11
|
|
|
11
|
|
32
|
my ( $self, $author, $dir ) = @_; |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
my @author |
591
|
11
|
|
|
|
|
43
|
= ( substr( $author, 0, 1 ), substr( $author, 0, 2 ), $author ); |
592
|
|
|
|
|
|
|
|
593
|
11
|
|
|
|
|
31
|
my $dm = $self->config->get( 'dirmode' ); |
594
|
|
|
|
|
|
|
my @new |
595
|
11
|
50
|
|
|
|
217
|
= _make_path( File::Spec->catdir( $dir, 'authors', 'id', @author ), |
596
|
|
|
|
|
|
|
defined $dm ? { mode => oct $dm } : {} ); |
597
|
|
|
|
|
|
|
|
598
|
11
|
|
|
|
|
123
|
return return File::Spec->catdir( @author ); |
599
|
|
|
|
|
|
|
} |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
sub _fmtmodule { |
602
|
15
|
|
|
15
|
|
662
|
my ( $module, $file, $version ) = @_; |
603
|
15
|
|
|
|
|
36
|
my $fw = 38 - length $version; |
604
|
15
|
100
|
|
|
|
55
|
$fw = length $module if $fw < length $module; |
605
|
15
|
|
|
|
|
147
|
return sprintf "%-${fw}s %s %s", $module, $version, $file; |
606
|
|
|
|
|
|
|
} |
607
|
|
|
|
|
|
|
|
608
|
0
|
|
|
0
|
|
0
|
sub _cfg { $_[0]->{config}{ $_[1] } } |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
sub _readpkgs { |
611
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
612
|
|
|
|
|
|
|
|
613
|
1
|
50
|
|
|
|
3
|
my $gzread = gzopen( |
614
|
|
|
|
|
|
|
$self->config->get( 'local' ) |
615
|
|
|
|
|
|
|
. '/modules/02packages.details.txt.gz', 'rb' |
616
|
|
|
|
|
|
|
) or croak "Cannot open local 02packages.details.txt.gz: $gzerrno"; |
617
|
|
|
|
|
|
|
|
618
|
1
|
|
|
|
|
2793
|
my $inheader = 1; |
619
|
1
|
|
|
|
|
2
|
my @packages; |
620
|
|
|
|
|
|
|
my $package; |
621
|
|
|
|
|
|
|
|
622
|
1
|
|
|
|
|
5
|
while ( $gzread->gzreadline( $package ) ) { |
623
|
15
|
100
|
|
|
|
1468
|
if ( $inheader ) { |
624
|
9
|
100
|
|
|
|
32
|
$inheader = 0 unless $package =~ /\S/; |
625
|
9
|
|
|
|
|
21
|
next; |
626
|
|
|
|
|
|
|
} |
627
|
6
|
|
|
|
|
12
|
chomp( $package ); |
628
|
6
|
|
|
|
|
16
|
push( @packages, $package ); |
629
|
|
|
|
|
|
|
} |
630
|
|
|
|
|
|
|
|
631
|
1
|
|
|
|
|
142
|
$gzread->gzclose; |
632
|
|
|
|
|
|
|
|
633
|
1
|
|
|
|
|
77
|
return \@packages; |
634
|
|
|
|
|
|
|
} |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
sub _writepkgs { |
637
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
638
|
1
|
|
|
|
|
2
|
my $pkgs = shift; |
639
|
|
|
|
|
|
|
|
640
|
1
|
50
|
|
|
|
5
|
my $gzwrite = gzopen( |
641
|
|
|
|
|
|
|
$self->config->get( 'local' ) |
642
|
|
|
|
|
|
|
. '/modules/02packages.details.txt.gz', 'wb' |
643
|
|
|
|
|
|
|
) |
644
|
|
|
|
|
|
|
or croak |
645
|
|
|
|
|
|
|
"Can't open local 02packages.details.txt.gz for writing: $gzerrno"; |
646
|
|
|
|
|
|
|
|
647
|
1
|
|
|
|
|
1659
|
$gzwrite->gzwrite( "File: 02packages.details.txt\n" ); |
648
|
1
|
|
|
|
|
164
|
$gzwrite->gzwrite( |
649
|
|
|
|
|
|
|
"URL: http://www.perl.com/CPAN/modules/02packages.details.txt\n" |
650
|
|
|
|
|
|
|
); |
651
|
1
|
|
|
|
|
88
|
$gzwrite->gzwrite( |
652
|
|
|
|
|
|
|
'Description: Package names found in directory $CPAN/authors/id/' |
653
|
|
|
|
|
|
|
. "\n" ); |
654
|
1
|
|
|
|
|
78
|
$gzwrite->gzwrite( "Columns: package name, version, path\n" ); |
655
|
1
|
|
|
|
|
76
|
$gzwrite->gzwrite( |
656
|
|
|
|
|
|
|
"Intended-For: Automated fetch routines, namespace documentation.\n" |
657
|
|
|
|
|
|
|
); |
658
|
1
|
|
|
|
|
88
|
$gzwrite->gzwrite( "Written-By: CPAN::Mini::Inject $VERSION\n" ); |
659
|
1
|
|
|
|
|
81
|
$gzwrite->gzwrite( "Line-Count: " . scalar( @$pkgs ) . "\n" ); |
660
|
|
|
|
|
|
|
# Last-Updated: Sat, 19 Mar 2005 19:49:10 GMT |
661
|
1
|
|
|
|
|
87
|
$gzwrite->gzwrite( "Last-Updated: " . _fmtdate() . "\n\n" ); |
662
|
|
|
|
|
|
|
|
663
|
1
|
|
|
|
|
88
|
$gzwrite->gzwrite( "$_\n" ) for ( @$pkgs ); |
664
|
|
|
|
|
|
|
|
665
|
1
|
|
|
|
|
541
|
$gzwrite->gzclose; |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
} |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
sub _readauthors { |
670
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
671
|
1
|
50
|
|
|
|
4
|
my $gzread |
672
|
|
|
|
|
|
|
= gzopen( $self->config->get( 'local' ) . '/authors/01mailrc.txt.gz', |
673
|
|
|
|
|
|
|
'rb' ) |
674
|
|
|
|
|
|
|
or croak "Cannot open " |
675
|
|
|
|
|
|
|
. $self->config->get( 'local' ) |
676
|
|
|
|
|
|
|
. "/authors/01mailrc.txt.gz: $gzerrno"; |
677
|
|
|
|
|
|
|
|
678
|
1
|
|
|
|
|
1999
|
my @authors; |
679
|
|
|
|
|
|
|
my $author; |
680
|
|
|
|
|
|
|
|
681
|
1
|
|
|
|
|
5
|
while ( $gzread->gzreadline( $author ) ) { |
682
|
4
|
|
|
|
|
517
|
chomp( $author ); |
683
|
4
|
|
|
|
|
11
|
push( @authors, $author ); |
684
|
|
|
|
|
|
|
} |
685
|
|
|
|
|
|
|
|
686
|
1
|
|
|
|
|
144
|
$gzread->gzclose; |
687
|
|
|
|
|
|
|
|
688
|
1
|
|
|
|
|
72
|
return \@authors; |
689
|
|
|
|
|
|
|
} |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
sub _writeauthors { |
692
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
693
|
1
|
|
|
|
|
3
|
my $authors = shift; |
694
|
|
|
|
|
|
|
|
695
|
1
|
50
|
|
|
|
4
|
my $gzwrite |
696
|
|
|
|
|
|
|
= gzopen( $self->config->get( 'local' ) . '/authors/01mailrc.txt.gz', |
697
|
|
|
|
|
|
|
'wb' ) |
698
|
|
|
|
|
|
|
or croak |
699
|
|
|
|
|
|
|
"Can't open local authors/01mailrc.txt.gz for writing: $gzerrno"; |
700
|
|
|
|
|
|
|
|
701
|
1
|
|
|
|
|
1395
|
$gzwrite->gzwrite( "$_\n" ) for ( sort @$authors ); |
702
|
|
|
|
|
|
|
|
703
|
1
|
|
|
|
|
485
|
$gzwrite->gzclose; |
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
} |
706
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
sub _fmtdate { |
708
|
1
|
|
|
1
|
|
16
|
my @date = split( /\s+/, scalar( gmtime ) ); |
709
|
1
|
|
|
|
|
9
|
return "$date[0], $date[2] $date[1] $date[4] $date[3] GMT"; |
710
|
|
|
|
|
|
|
} |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
=head1 See Also |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
L |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
=head1 Current Maintainer |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
Christian Walde C<< >> |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
=head1 Original Author |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
Shawn Sorichetti, C<< >> |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=head1 Acknowledgements |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
Special thanks to David Bartle, for bringing this module up |
727
|
|
|
|
|
|
|
to date, and resolving the reported bugs. |
728
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
Thanks to Jozef Kutej for numerous patches. |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
=head1 Bugs |
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
734
|
|
|
|
|
|
|
C, or through the web interface at |
735
|
|
|
|
|
|
|
L. I will be notified, and then you'll automatically |
736
|
|
|
|
|
|
|
be notified of progress on your bug as I make changes. |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
=head1 Copyright & License |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
Copyright 2008-2009 Shawn Sorichetti, Andy Armstrong, All Rights Reserved. |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
743
|
|
|
|
|
|
|
under the same terms as Perl itself. |
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
=cut |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
1; # End of CPAN::Mini::Inject |