line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::PodParser; |
2
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
705
|
use strict; |
|
19
|
|
|
|
|
51
|
|
|
19
|
|
|
|
|
871
|
|
4
|
19
|
|
|
19
|
|
111
|
use warnings; |
|
19
|
|
|
|
|
57
|
|
|
19
|
|
|
|
|
12526
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.42_35'; |
6
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
|
|
|
|
|
|
# Perl is so fun. |
10
|
73
|
|
|
73
|
0
|
5813
|
my $package = shift; |
11
|
|
|
|
|
|
|
|
12
|
73
|
|
|
|
|
147
|
my $self; |
13
|
73
|
|
|
|
|
410
|
$self = bless {have_pod_parser => 0, @_}, $package; |
14
|
|
|
|
|
|
|
|
15
|
73
|
50
|
|
|
|
359
|
unless ($self->{fh}) { |
16
|
0
|
0
|
|
|
|
0
|
die "No 'file' or 'fh' parameter given" unless $self->{file}; |
17
|
0
|
0
|
|
|
|
0
|
open($self->{fh}, '<', $self->{file}) or die "Couldn't open $self->{file}: $!"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
73
|
|
|
|
|
254
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub parse_from_filehandle { |
24
|
73
|
|
|
73
|
0
|
164
|
my ($self, $fh) = @_; |
25
|
|
|
|
|
|
|
|
26
|
73
|
|
|
|
|
132
|
local $_; |
27
|
73
|
|
|
|
|
1228
|
while (<$fh>) { |
28
|
1608
|
100
|
|
|
|
4358
|
next unless /^ =encoding \s+ (\S+)/ix; |
29
|
1
|
|
|
1
|
|
28
|
binmode $fh, ":encoding($1)"; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
30
|
1
|
|
|
|
|
871
|
last; |
31
|
|
|
|
|
|
|
} |
32
|
73
|
|
|
|
|
552
|
seek $fh, 0, 0; |
33
|
|
|
|
|
|
|
|
34
|
73
|
|
|
|
|
647
|
while (<$fh>) { |
35
|
1008
|
100
|
|
|
|
2323
|
next unless /^=(?!cut)/ .. /^=cut/; # in POD |
36
|
|
|
|
|
|
|
# Accept Name - abstract or C - abstract |
37
|
691
|
100
|
|
|
|
2279
|
last if ($self->{abstract}) = /^ (?: [a-z_0-9:]+ | [BCIF] < [a-z_0-9:]+ > ) \s+ - \s+ (.*\S) /ix; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
73
|
|
|
|
|
181
|
my @author; |
41
|
73
|
|
|
|
|
273
|
while (<$fh>) { |
42
|
612
|
100
|
|
|
|
1779
|
next unless /^=head1\s+AUTHORS?/i ... /^=/; |
43
|
345
|
100
|
|
|
|
1299
|
next if /^=/; |
44
|
211
|
100
|
|
|
|
733
|
push @author, $_ if /\@/; |
45
|
|
|
|
|
|
|
} |
46
|
73
|
100
|
|
|
|
260
|
return unless @author; |
47
|
67
|
|
|
|
|
781
|
s/^\s+|\s+$//g foreach @author; |
48
|
|
|
|
|
|
|
|
49
|
67
|
|
|
|
|
239
|
$self->{author} = \@author; |
50
|
|
|
|
|
|
|
|
51
|
67
|
|
|
|
|
250
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub get_abstract { |
55
|
45
|
|
|
45
|
0
|
917
|
my $self = shift; |
56
|
45
|
100
|
|
|
|
194
|
return $self->{abstract} if defined $self->{abstract}; |
57
|
|
|
|
|
|
|
|
58
|
41
|
|
|
|
|
163
|
$self->parse_from_filehandle($self->{fh}); |
59
|
|
|
|
|
|
|
|
60
|
41
|
|
|
|
|
587
|
return $self->{abstract}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub get_author { |
64
|
32
|
|
|
32
|
0
|
2203
|
my $self = shift; |
65
|
32
|
50
|
|
|
|
116
|
return $self->{author} if defined $self->{author}; |
66
|
|
|
|
|
|
|
|
67
|
32
|
|
|
|
|
110
|
$self->parse_from_filehandle($self->{fh}); |
68
|
|
|
|
|
|
|
|
69
|
32
|
|
100
|
|
|
757
|
return $self->{author} || []; |
70
|
|
|
|
|
|
|
} |