| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pod::Generate::Recursive; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
26002
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
39
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
34
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
|
|
104
|
use vars qw{ |
|
7
|
|
|
|
|
|
|
$VERSION |
|
8
|
|
|
|
|
|
|
@ISA |
|
9
|
|
|
|
|
|
|
@EXPORT |
|
10
|
|
|
|
|
|
|
@EXPORT_OK |
|
11
|
|
|
|
|
|
|
$source |
|
12
|
|
|
|
|
|
|
$destination |
|
13
|
|
|
|
|
|
|
$debug |
|
14
|
1
|
|
|
1
|
|
4
|
}; |
|
|
1
|
|
|
|
|
1
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
BEGIN |
|
17
|
|
|
|
|
|
|
{ |
|
18
|
1
|
|
|
1
|
|
4
|
require Exporter; |
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
13
|
@ISA = qw( Exporter ); |
|
21
|
1
|
|
|
|
|
1
|
@EXPORT = qw( debug destination source); |
|
22
|
1
|
|
|
|
|
21
|
@EXPORT_OK = qw( ); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
4
|
use Data::Dumper qw(Dumper); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
47
|
|
|
26
|
1
|
|
|
1
|
|
5
|
use File::Find qw( finddepth ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
52
|
|
|
27
|
1
|
|
|
1
|
|
4
|
use File::Path qw( make_path ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
45
|
|
|
28
|
1
|
|
|
1
|
|
694
|
use Pod::POM; |
|
|
1
|
|
|
|
|
20366
|
|
|
|
1
|
|
|
|
|
69
|
|
|
29
|
1
|
|
|
1
|
|
12
|
use Pod::POM::View::Pod; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
664
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Pod::Generate::Recursive - Generate POD for directory contents. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
If you've ever come across a code base and wanted to easily generate |
|
38
|
|
|
|
|
|
|
POD from the source then you've probably written a small script to |
|
39
|
|
|
|
|
|
|
do it for you. You no longer need to do it and can instead point this |
|
40
|
|
|
|
|
|
|
code at you source and have it generate POD from .pl and .pm files. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Enjoy! |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Version 0.5 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
our $VERSION = '0.5'; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use Pod::Generate::Recursive; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $pgr = Pod::Generate::Recursive->new(); |
|
57
|
|
|
|
|
|
|
$pgr->source("catalyst/"); |
|
58
|
|
|
|
|
|
|
$pgr->destination("docs/"); |
|
59
|
|
|
|
|
|
|
$pgr->debug(1); |
|
60
|
|
|
|
|
|
|
$pgr->run(); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my %files = (); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 run |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Generate the docs. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub run |
|
77
|
|
|
|
|
|
|
{ |
|
78
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my ( |
|
81
|
0
|
|
|
|
|
|
$directory, $file, $filehandle, $filename, $newbase, |
|
82
|
|
|
|
|
|
|
$parser, $pod, $pom, $targetdir, $oldfile |
|
83
|
|
|
|
|
|
|
) |
|
84
|
|
|
|
|
|
|
= (undef, undef, undef, undef, undef, undef, undef, undef, undef, undef); |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
die "ERROR: Source directory cannot be empty.\n" if !$self->{source}; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
die "ERROR: Destination directory cannot be empty.\n" |
|
89
|
|
|
|
|
|
|
if !$self->{destination}; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
|
if (!-d $self->{destination}) |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
0
|
0
|
|
|
|
|
make_path $self->{destination} |
|
94
|
|
|
|
|
|
|
or die "Failed to create $self->{destination}.\n"; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
finddepth(\&_wanted, ($self->{source})); |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
if ($self->{debug}) { print Dumper(%files) } |
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
while (($filename, $directory) = each %files) |
|
102
|
|
|
|
|
|
|
{ |
|
103
|
0
|
|
|
|
|
|
$newbase = File::Spec->catdir(($self->{destination}, $directory)); |
|
104
|
0
|
|
|
|
|
|
$oldfile = File::Spec->catdir(($directory, $filename)); |
|
105
|
0
|
0
|
|
|
|
|
if ($self->{debug}) { print $newbase . "\n" } |
|
|
0
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
if (!-d $newbase) |
|
107
|
|
|
|
|
|
|
{ |
|
108
|
0
|
0
|
|
|
|
|
make_path $newbase or die "Failed to create $newbase.\n"; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
|
0
|
|
|
|
$pom = $self->{parser}->parse_file($oldfile) || die $parser->error(); |
|
112
|
0
|
|
|
|
|
|
$pod = Pod::POM::View::Pod->print($pom); |
|
113
|
0
|
|
|
|
|
|
$targetdir = dir($newbase); |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
## Should we change the extension to pod? |
|
116
|
0
|
|
|
|
|
|
$file = $targetdir->file($filename); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
## Missing docs |
|
119
|
0
|
0
|
|
|
|
|
if ($pod eq "") |
|
120
|
|
|
|
|
|
|
{ |
|
121
|
0
|
|
|
|
|
|
$file = $targetdir->file($filename . ".MISSING"); |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
$filehandle = $file->openw(); |
|
125
|
0
|
|
|
|
|
|
$filehandle->print($pod . "\n"); |
|
126
|
0
|
|
|
|
|
|
$filehandle->close; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 wanted |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Find wanted files. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub _wanted |
|
138
|
|
|
|
|
|
|
{ |
|
139
|
|
|
|
|
|
|
## No hidden files |
|
140
|
0
|
0
|
|
0
|
|
|
return if $_ =~ m/^\./; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
## Skip dirs |
|
143
|
0
|
0
|
|
|
|
|
return if !-f $_; |
|
144
|
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
print $_ . "\n"; |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
0
|
|
|
|
|
$files{"$_"} = "$File::Find::dir" if $_ =~ /\.p[ml]/; |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 debug |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Debug output |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub debug |
|
158
|
|
|
|
|
|
|
{ |
|
159
|
0
|
|
|
0
|
1
|
|
my ($self, $debug) = @_; |
|
160
|
0
|
0
|
|
|
|
|
if ($debug) |
|
161
|
|
|
|
|
|
|
{ |
|
162
|
0
|
|
|
|
|
|
$self->{debug} = $debug; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
0
|
|
|
|
|
|
return $self->{debug}; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 destination |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Set the destination for docs. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub destination |
|
174
|
|
|
|
|
|
|
{ |
|
175
|
0
|
|
|
0
|
1
|
|
my ($self, $destination) = @_; |
|
176
|
0
|
0
|
|
|
|
|
if ($destination) |
|
177
|
|
|
|
|
|
|
{ |
|
178
|
0
|
|
|
|
|
|
$self->{destination} = $destination; |
|
179
|
|
|
|
|
|
|
} |
|
180
|
0
|
|
|
|
|
|
return $self->{destination}; |
|
181
|
|
|
|
|
|
|
} |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 source |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Set the source directory. |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=cut |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub source |
|
190
|
|
|
|
|
|
|
{ |
|
191
|
0
|
|
|
0
|
1
|
|
my ($self, $source) = @_; |
|
192
|
0
|
0
|
|
|
|
|
if ($source) |
|
193
|
|
|
|
|
|
|
{ |
|
194
|
0
|
|
|
|
|
|
$self->{source} = $source; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
0
|
|
|
|
|
|
return $self->{source}; |
|
197
|
|
|
|
|
|
|
} |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head2 new |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Create a new instance. |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub new |
|
206
|
|
|
|
|
|
|
{ |
|
207
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
208
|
|
|
|
|
|
|
|
|
209
|
0
|
|
|
|
|
|
my $self = {}; |
|
210
|
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
bless $self, $class; |
|
212
|
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
$self->{source} = undef; |
|
214
|
0
|
|
|
|
|
|
$self->{destination} = undef; |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
## Parsing files. ## |
|
217
|
0
|
|
|
|
|
|
$self->{parser} = Pod::POM->new(); |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
## Debug |
|
220
|
0
|
|
|
|
|
|
$self->{debug} = 0; |
|
221
|
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
|
return $self; |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 AUTHOR |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Adam M Dutko, C<< >> |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head1 BUGS |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
232
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
233
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head1 SUPPORT |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
perldoc Pod::Generate::Recursive |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
You can also look for information at: |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=over 4 |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
L |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
L |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
L |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=item * Search CPAN |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
L |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=back |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Copyright 2014 Adam M Dutko. |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
274
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
275
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
See L for more information. |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
=cut |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
1; # End of Pod::Generate::Recursive |