line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EPublisher::Source::Plugin::File; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: File source plugin |
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
67212
|
use strict; |
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
271
|
|
6
|
9
|
|
|
9
|
|
48
|
use warnings; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
223
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
50
|
use File::Basename; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
635
|
|
9
|
|
|
|
|
|
|
|
10
|
9
|
|
|
9
|
|
3431
|
use EPublisher::Source::Base; |
|
9
|
|
|
|
|
25
|
|
|
9
|
|
|
|
|
284
|
|
11
|
9
|
|
|
9
|
|
3311
|
use EPublisher::Utils::PPI qw(extract_pod); |
|
9
|
|
|
|
|
33
|
|
|
9
|
|
|
|
|
2757
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @ISA = qw( EPublisher::Source::Base ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = 0.05; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub load_source{ |
18
|
22
|
|
|
22
|
1
|
4457
|
my ($self, $source_path) = @_; |
19
|
|
|
|
|
|
|
|
20
|
22
|
|
|
|
|
81
|
my $options = $self->_config; |
21
|
|
|
|
|
|
|
|
22
|
22
|
|
100
|
|
|
135
|
my $file = $source_path // $options->{path}; |
23
|
|
|
|
|
|
|
|
24
|
22
|
100
|
|
|
|
85
|
if ( !defined $file ) { |
25
|
1
|
|
|
|
|
4
|
$self->publisher->debug( "400: No path given" ); |
26
|
1
|
|
|
|
|
5
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
21
|
100
|
|
|
|
547
|
if( !-f $file ) { |
30
|
5
|
|
|
|
|
25
|
$self->publisher->debug( "400: $file is not a file" ); |
31
|
5
|
|
|
|
|
27
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
16
|
|
|
|
|
95
|
my $pod = extract_pod( $file, $self->_config ); |
35
|
16
|
|
|
|
|
24675
|
my $filename = basename $file; |
36
|
16
|
|
|
|
|
51
|
my $title = $filename; |
37
|
|
|
|
|
|
|
|
38
|
16
|
100
|
|
|
|
77
|
$options->{title} = '' if !defined $options->{title}; |
39
|
|
|
|
|
|
|
|
40
|
16
|
100
|
|
|
|
86
|
if ( $options->{title} eq 'pod' ) { |
|
|
100
|
|
|
|
|
|
41
|
5
|
|
|
|
|
26
|
($title) = $pod =~ m{ =head1 \s+ (.*) }x; |
42
|
5
|
100
|
|
|
|
24
|
$title = '' if !defined $title; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif ( length $options->{title} ) { |
45
|
3
|
|
|
|
|
10
|
$title = $options->{title}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
16
|
|
|
|
|
220
|
return { pod => $pod, filename => $filename, title => $title }; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |