| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package EPublisher::Source::Plugin::Dir; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Dir source plugin |
|
4
|
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
211787
|
use strict; |
|
|
4
|
|
|
|
|
39
|
|
|
|
4
|
|
|
|
|
125
|
|
|
6
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
110
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
2172
|
use File::Find::Rule; |
|
|
4
|
|
|
|
|
33905
|
|
|
|
4
|
|
|
|
|
34
|
|
|
9
|
4
|
|
|
4
|
|
235
|
use File::Basename; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
289
|
|
|
10
|
4
|
|
|
4
|
|
27
|
use List::Util qw(first); |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
410
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
|
2078
|
use EPublisher::Source::Base; |
|
|
4
|
|
|
|
|
12
|
|
|
|
4
|
|
|
|
|
160
|
|
|
13
|
4
|
|
|
4
|
|
1704
|
use EPublisher::Utils::PPI qw(extract_pod extract_package); |
|
|
4
|
|
|
|
|
15
|
|
|
|
4
|
|
|
|
|
2685
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA = qw( EPublisher::Source::Base ); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 1.1; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub load_source{ |
|
20
|
26
|
|
|
26
|
1
|
4483
|
my ($self, $source_path) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
26
|
|
|
|
|
70
|
my $options = $self->_config; |
|
23
|
|
|
|
|
|
|
|
|
24
|
26
|
|
100
|
|
|
173
|
my $path = $source_path || $options->{path}; |
|
25
|
|
|
|
|
|
|
|
|
26
|
26
|
100
|
|
|
|
113
|
if ( !defined $path ) { |
|
27
|
1
|
|
|
|
|
4
|
$self->publisher->debug( "400: No path given" ); |
|
28
|
1
|
|
|
|
|
5
|
return; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
25
|
100
|
|
|
|
92
|
my @paths = ref $path eq 'ARRAY' ? @{$path} : ($path); |
|
|
8
|
|
|
|
|
23
|
|
|
32
|
25
|
|
|
|
|
42
|
my @paths_to_use; |
|
33
|
|
|
|
|
|
|
|
|
34
|
25
|
|
|
|
|
54
|
for my $path_to_check ( @paths ) { |
|
35
|
29
|
100
|
|
|
|
70
|
if ( !defined $path_to_check ) { |
|
36
|
1
|
|
|
|
|
4
|
$self->publisher->debug( "400: undefined path given" ); |
|
37
|
1
|
|
|
|
|
4
|
next; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
28
|
100
|
|
|
|
533
|
if ( !-d $path_to_check ) { |
|
40
|
3
|
|
|
|
|
20
|
$self->publisher->debug( "400: $path_to_check does not exist" ); |
|
41
|
3
|
|
|
|
|
19
|
next; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
25
|
|
|
|
|
110
|
push @paths_to_use, $path_to_check; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
25
|
100
|
|
|
|
86
|
return if !@paths_to_use; |
|
48
|
|
|
|
|
|
|
|
|
49
|
23
|
|
|
|
|
41
|
my @testrule; |
|
50
|
23
|
100
|
|
|
|
61
|
if ( $options->{testfiles} ) { |
|
51
|
1
|
|
|
|
|
6
|
@testrule = (qr/\.t\z/); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
23
|
|
|
|
|
786
|
my $rule = File::Find::Rule->file->name( qr/\.p(?:m|od|l)\z/, @testrule ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
23
|
100
|
100
|
|
|
1826
|
if ( defined $options->{subdirs} && $options->{subdirs} == 0 ) { |
|
57
|
1
|
|
|
|
|
5
|
$rule->maxdepth( 1 ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
23
|
|
|
|
|
129
|
my @files = sort $rule->in( @paths_to_use ); |
|
61
|
23
|
|
|
|
|
20326
|
my @pods; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my @excludes; |
|
64
|
23
|
100
|
|
|
|
84
|
if ( $options->{exclude} ) { |
|
65
|
4
|
100
|
|
|
|
42
|
@excludes = ref $options->{exclude} eq 'ARRAY' ? @{ $options->{exclude} } : ($options->{exclude}); |
|
|
1
|
|
|
|
|
6
|
|
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
23
|
100
|
|
|
|
69
|
$options->{title} = '' if !defined $options->{title}; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
FILE: |
|
71
|
23
|
|
|
|
|
72
|
for my $file ( @files ) { |
|
72
|
|
|
|
|
|
|
|
|
73
|
67
|
100
|
|
8
|
|
577
|
next FILE if first{ $file =~ m{\A \Q$_\E }xms }@excludes; |
|
|
8
|
|
|
|
|
92
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
65
|
|
|
|
|
422
|
my $pod = extract_pod( $file, $self->_config ); |
|
76
|
|
|
|
|
|
|
|
|
77
|
65
|
100
|
|
|
|
80539
|
next FILE if !$pod; |
|
78
|
|
|
|
|
|
|
|
|
79
|
32
|
|
|
|
|
1171
|
my $filename = basename $file; |
|
80
|
32
|
|
|
|
|
82
|
my $title = $filename; |
|
81
|
|
|
|
|
|
|
|
|
82
|
32
|
100
|
|
|
|
137
|
if ( $options->{title} eq 'pod' ) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
83
|
19
|
|
|
|
|
91
|
($title) = $pod =~ m{ =head1 \s+ (.*) }x; |
|
84
|
19
|
100
|
|
|
|
67
|
$title = '' if !defined $title; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
elsif ( $options->{title} eq 'package' ) { |
|
87
|
6
|
|
|
|
|
22
|
my $package = extract_package( $file, $self->_config ); |
|
88
|
6
|
100
|
|
|
|
657
|
$title = $package if $package; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
elsif ( length $options->{title} ) { |
|
91
|
1
|
|
|
|
|
3
|
$title = $options->{title}; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
32
|
|
|
|
|
177
|
push @pods, { pod => $pod, title => $title, filename => $filename }; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
23
|
|
|
|
|
306
|
return @pods; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |