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