line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EPublisher::Source::Plugin::Module; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Module source plugin |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
71077
|
use strict; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
91
|
|
6
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
79
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
1560
|
use Module::Info; |
|
3
|
|
|
|
|
20358
|
|
|
3
|
|
|
|
|
93
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
24
|
use File::Basename; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
205
|
|
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
1389
|
use EPublisher::Source::Base; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
114
|
|
13
|
3
|
|
|
3
|
|
1206
|
use EPublisher::Utils::PPI qw(extract_pod); |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
1043
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA = qw( EPublisher::Source::Base ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 0.05; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub load_source{ |
20
|
10
|
|
|
10
|
1
|
802
|
my ($self, $name) = @_; |
21
|
|
|
|
|
|
|
|
22
|
10
|
|
|
|
|
35
|
my $options = $self->_config; |
23
|
10
|
|
100
|
|
|
74
|
my $module = $name // $options->{name}; |
24
|
|
|
|
|
|
|
|
25
|
10
|
100
|
|
|
|
28
|
if ( !defined $module ) { |
26
|
1
|
|
|
|
|
4
|
$self->publisher->debug( '400: No module defined' ); |
27
|
1
|
|
|
|
|
5
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
9
|
100
|
|
|
|
17
|
my @my_inc = @{ $options->{lib} || [] }; |
|
9
|
|
|
|
|
49
|
|
31
|
|
|
|
|
|
|
|
32
|
9
|
|
|
|
|
60
|
my $mod = Module::Info->new_from_module( $module, @my_inc ); |
33
|
|
|
|
|
|
|
|
34
|
9
|
100
|
|
|
|
1426
|
if ( !$mod ) { |
35
|
2
|
|
|
|
|
9
|
$self->publisher->debug( '400: Cannot find module' ); |
36
|
2
|
|
|
|
|
11
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
7
|
|
|
|
|
31
|
my $pod = extract_pod( $mod->file, $self->_config ); |
40
|
7
|
|
|
|
|
59345
|
my $filename = File::Basename::basename( $mod->file ); |
41
|
7
|
|
|
|
|
374
|
my $title = $module; |
42
|
|
|
|
|
|
|
|
43
|
7
|
100
|
|
|
|
30
|
$options->{title} = '' if !defined $options->{title}; |
44
|
|
|
|
|
|
|
|
45
|
7
|
100
|
|
|
|
36
|
if ( $options->{title} eq 'pod' ) { |
|
|
100
|
|
|
|
|
|
46
|
2
|
|
|
|
|
10
|
($title) = $pod =~ m{ =head1 \s+ (.*) }x; |
47
|
2
|
100
|
|
|
|
8
|
$title = '' if !defined $title; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
elsif ( length $options->{title} ) { |
50
|
1
|
|
|
|
|
4
|
$title = $options->{title}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
7
|
|
|
|
|
86
|
return { pod => $pod, filename => $filename, title => $title }; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |