line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::PodParser; |
2
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
853
|
use strict; |
|
19
|
|
|
|
|
59
|
|
|
19
|
|
|
|
|
1011
|
|
4
|
19
|
|
|
19
|
|
189
|
use warnings; |
|
19
|
|
|
|
|
57
|
|
|
19
|
|
|
|
|
15858
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.4234'; |
6
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
|
|
|
|
|
|
# Perl is so fun. |
10
|
73
|
|
|
73
|
0
|
3982
|
my $package = shift; |
11
|
|
|
|
|
|
|
|
12
|
73
|
|
|
|
|
178
|
my $self; |
13
|
73
|
|
|
|
|
475
|
$self = bless {have_pod_parser => 0, @_}, $package; |
14
|
|
|
|
|
|
|
|
15
|
73
|
50
|
|
|
|
455
|
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
|
|
|
|
|
288
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub parse_from_filehandle { |
24
|
73
|
|
|
73
|
0
|
197
|
my ($self, $fh) = @_; |
25
|
|
|
|
|
|
|
|
26
|
73
|
|
|
|
|
141
|
local $_; |
27
|
73
|
|
|
|
|
1512
|
while (<$fh>) { |
28
|
1608
|
100
|
|
|
|
5028
|
next unless /^ =encoding \s+ (\S+)/ix; |
29
|
1
|
|
|
1
|
|
27
|
binmode $fh, ":encoding($1)"; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
30
|
1
|
|
|
|
|
1024
|
last; |
31
|
|
|
|
|
|
|
} |
32
|
73
|
|
|
|
|
676
|
seek $fh, 0, 0; |
33
|
|
|
|
|
|
|
|
34
|
73
|
|
|
|
|
747
|
while (<$fh>) { |
35
|
1008
|
100
|
|
|
|
2624
|
next unless /^=(?!cut)/ .. /^=cut/; # in POD |
36
|
|
|
|
|
|
|
# Accept Name - abstract or C<Name> - abstract |
37
|
691
|
100
|
|
|
|
2669
|
last if ($self->{abstract}) = /^ (?: [a-z_0-9:]+ | [BCIF] < [a-z_0-9:]+ > ) \s+ - \s+ (.*\S) /ix; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
73
|
|
|
|
|
221
|
my @author; |
41
|
73
|
|
|
|
|
304
|
while (<$fh>) { |
42
|
612
|
100
|
|
|
|
2066
|
next unless /^=head1\s+AUTHORS?/i ... /^=/; |
43
|
345
|
100
|
|
|
|
1665
|
next if /^=/; |
44
|
211
|
100
|
|
|
|
806
|
push @author, $_ if /\@/; |
45
|
|
|
|
|
|
|
} |
46
|
73
|
100
|
|
|
|
331
|
return unless @author; |
47
|
67
|
|
|
|
|
912
|
s/^\s+|\s+$//g foreach @author; |
48
|
|
|
|
|
|
|
|
49
|
67
|
|
|
|
|
372
|
$self->{author} = \@author; |
50
|
|
|
|
|
|
|
|
51
|
67
|
|
|
|
|
308
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub get_abstract { |
55
|
45
|
|
|
45
|
0
|
730
|
my $self = shift; |
56
|
45
|
100
|
|
|
|
190
|
return $self->{abstract} if defined $self->{abstract}; |
57
|
|
|
|
|
|
|
|
58
|
41
|
|
|
|
|
214
|
$self->parse_from_filehandle($self->{fh}); |
59
|
|
|
|
|
|
|
|
60
|
41
|
|
|
|
|
671
|
return $self->{abstract}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub get_author { |
64
|
32
|
|
|
32
|
0
|
1477
|
my $self = shift; |
65
|
32
|
50
|
|
|
|
183
|
return $self->{author} if defined $self->{author}; |
66
|
|
|
|
|
|
|
|
67
|
32
|
|
|
|
|
160
|
$self->parse_from_filehandle($self->{fh}); |
68
|
|
|
|
|
|
|
|
69
|
32
|
|
100
|
|
|
977
|
return $self->{author} || []; |
70
|
|
|
|
|
|
|
} |