line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Mini::FromList; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
28491
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
7
|
|
|
|
|
|
|
# ABSTRACT: create a minimal CPAN mirror from a list of modules you specify |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1025
|
use CPAN::Mini; |
|
1
|
|
|
|
|
260660
|
|
|
1
|
|
|
|
|
51
|
|
10
|
1
|
|
|
1
|
|
1915
|
use Data::Dumper; |
|
1
|
|
|
|
|
14631
|
|
|
1
|
|
|
|
|
90
|
|
11
|
1
|
|
|
1
|
|
1243
|
use File::Spec::Functions; |
|
1
|
|
|
|
|
1129
|
|
|
1
|
|
|
|
|
145
|
|
12
|
1
|
|
|
1
|
|
8
|
use base qw(CPAN::Mini); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1633
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our %dists = (); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub update_mirror { |
20
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my @args = @_; |
22
|
0
|
|
|
|
|
|
my %args=@args; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
foreach my $d (@{$args{list}}) { |
|
0
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$dists{$d} = 1; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
CPAN::Mini->update_mirror(@args, 'module_filters', [\&_fromlist_filter]); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _fromlist_filter { |
32
|
0
|
|
|
0
|
|
|
my $module = shift; |
33
|
0
|
0
|
|
|
|
|
return 1 if ! $dists{$module}; |
34
|
0
|
|
|
|
|
|
return 0; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub delete_02packages { |
39
|
0
|
|
|
0
|
1
|
|
my ($class,$local)=@_; |
40
|
0
|
|
|
|
|
|
my $packages02=catfile($local,qw(modules 02packages.details.txt.gz)); |
41
|
0
|
0
|
|
|
|
|
if (-e $packages02) { |
42
|
0
|
0
|
|
|
|
|
unlink ($packages02) || die "Cannot unlink $packages02: $!"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub generate_fake_02packages { |
48
|
0
|
|
|
0
|
1
|
|
my ($class,$local)=@_; |
49
|
0
|
|
|
|
|
|
eval { |
50
|
0
|
|
|
|
|
|
my $packages=catfile($local,qw(modules 02packages.details.txt)); |
51
|
0
|
|
|
|
|
|
my @files=File::Find::Rule->file()->name('*.gz')->relative->in( |
52
|
|
|
|
|
|
|
catdir($local,qw(authors id))); |
53
|
0
|
0
|
|
|
|
|
open(my $fh,'>',$packages) || die "Cannot write to $packages: $!"; |
54
|
0
|
|
|
|
|
|
my $linecnt=@files; |
55
|
0
|
|
|
|
|
|
my $now=scalar localtime; |
56
|
0
|
|
|
|
|
|
print $fh <<"EOHEAD"; |
57
|
|
|
|
|
|
|
File: 02packages.details.txt |
58
|
|
|
|
|
|
|
URL: http://www.perl.com/CPAN/modules/02packages.details.txt |
59
|
|
|
|
|
|
|
Description: Fake 02packges generate by CPAN::Mini::FromList |
60
|
|
|
|
|
|
|
Columns: package name, version, path |
61
|
|
|
|
|
|
|
Intended-For: Automated fetch routines, namespace documentation. |
62
|
|
|
|
|
|
|
Written-By: CPAN::Mini::FromList |
63
|
|
|
|
|
|
|
Line-Count: $linecnt |
64
|
|
|
|
|
|
|
Last-Updated: $now |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
EOHEAD |
67
|
0
|
|
|
|
|
|
foreach (@files) { |
68
|
0
|
|
|
|
|
|
print $fh "Fake undef $_\n"; |
69
|
|
|
|
|
|
|
} |
70
|
0
|
|
|
|
|
|
close $fh; |
71
|
0
|
|
|
|
|
|
$class->delete_02packages($local); |
72
|
0
|
|
|
|
|
|
system('gzip',$packages); |
73
|
|
|
|
|
|
|
}; |
74
|
0
|
0
|
|
|
|
|
print $@ if $@; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
q{ listening to: |
79
|
|
|
|
|
|
|
CPAN discussions at the Oslo QA Hackathon |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
CPAN::Mini::FromList - create a minimal CPAN mirror from a list of modules you specify |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 VERSION |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
version 0.05 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SYNOPSIS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Unless you need to do something unusual, you probably should be looking |
97
|
|
|
|
|
|
|
at C. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
use CPAN::Mini::FromList; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
CPAN::Mini::FromList->update_mirror(%args); |
102
|
|
|
|
|
|
|
... |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 NAME |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
CPAN::Mini::FromList - create a minimal CPAN mirror of modules you specify |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 METHODS |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 update_mirror %args |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Begins the process of creating a local CPAN mirror, but only downloads |
113
|
|
|
|
|
|
|
modules specified by the user. See the documentation in CPAN::Mini for |
114
|
|
|
|
|
|
|
more details on the arguments. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head3 delete_02packages |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Delete 02packages.details.txt.gz |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head3 generate_fake_02packages |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Generate a fake 02packages.details.txt.gz containing only the packages |
123
|
|
|
|
|
|
|
listed. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Thomas Klausner, C<< domm@cpan.org >> |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
based on CPAN::Mini::Phalanx100 by Steve Peters |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 BUGS |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
134
|
|
|
|
|
|
|
C, or through the web interface at |
135
|
|
|
|
|
|
|
L. I will be notified, and then you'll automatically |
136
|
|
|
|
|
|
|
be notified of progress on your bug as I make changes. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 SEE ALSO |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
L |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Thanks to... |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Ricardo Signes - for writing L, which does 99% of the work in this module |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Steve Peters - for writing CPAN::Mini::Phalanx100, from which I copied most of this code |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Copyright 2008 Thomas Klausner, All Rights Reserved. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
155
|
|
|
|
|
|
|
under the same terms as Perl itself. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 AUTHOR |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Thomas Klausner |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Thomas Klausner. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
166
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=cut |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
__END__ |