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