line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Tree::PerlUtil; |
2
|
7
|
|
|
7
|
|
1004539
|
use 5.006; |
|
7
|
|
|
|
|
30
|
|
3
|
7
|
|
|
7
|
|
51
|
use strict; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
253
|
|
4
|
7
|
|
|
7
|
|
38
|
use warnings; |
|
7
|
|
|
|
|
27
|
|
|
7
|
|
|
|
|
4728
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.31'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub mkdir { |
9
|
0
|
|
|
0
|
0
|
|
my ( $translator, $dir ) = @_; |
10
|
|
|
|
|
|
|
|
11
|
0
|
0
|
0
|
|
|
|
-d $dir |
12
|
|
|
|
|
|
|
or CORE::mkdir $dir, oct(755) |
13
|
|
|
|
|
|
|
or die "Pod::Tree::PerlUtil::mkdir: Can't mkdir $dir: $!\n"; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub report1 { |
17
|
0
|
|
|
0
|
0
|
|
my ( $translator, $routine ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
$translator->{options}{v} < 1 and return; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $package = ref $translator; |
22
|
0
|
|
|
|
|
|
my $name = "${package}::$routine"; |
23
|
0
|
|
|
|
|
|
my $pad = 60 - length $name; |
24
|
0
|
|
|
|
|
|
print STDERR $name, ' ' x $pad, "\n"; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub report2 { |
28
|
0
|
|
|
0
|
0
|
|
my ( $translator, $page ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $verbosity = $translator->{options}{v}; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
$verbosity == 2 and do { |
33
|
0
|
|
|
|
|
|
my $pad = 60 - length $page; |
34
|
0
|
|
|
|
|
|
print STDERR $page, ' ' x $pad, "\r"; |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
$verbosity == 3 and print STDERR "$page\n"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub get_name { |
41
|
0
|
|
|
0
|
0
|
|
my ( $node, $source ) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $tree = Pod::Tree->new; |
44
|
0
|
|
|
|
|
|
$tree->load_file($source); |
45
|
0
|
|
|
|
|
|
my $children = $tree->get_root->get_children; |
46
|
0
|
|
|
|
|
|
my @pod = grep { $_->is_pod } @$children; |
|
0
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $node1 = $pod[1]; |
48
|
0
|
0
|
|
|
|
|
$node1 or return (); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $text = $node1->get_deep_text; |
51
|
0
|
|
|
|
|
|
$text =~ s(\s+)( )g; |
52
|
0
|
|
|
|
|
|
$text =~ s(^ )(); |
53
|
0
|
|
|
|
|
|
$text =~ s( $)(); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my ( $name, $description ) = split m(\s+-+\s+), $text, 2; |
56
|
0
|
0
|
|
|
|
|
$name or return (); # empty!!! |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
0
|
|
|
|
if ( $name =~ /\s/ and not $description ) { |
59
|
0
|
|
|
|
|
|
$description = $name; |
60
|
0
|
|
|
|
|
|
my @description = split ' ', $description; |
61
|
0
|
0
|
0
|
|
|
|
if ( @description > 1 and $description[0] =~ /::/ ) { |
62
|
0
|
|
|
|
|
|
$name = shift @description; # guess |
63
|
0
|
|
|
|
|
|
$description = join ' ', @description; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
else # desperation |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
|
|
|
my @source = split m(/), $source; |
68
|
0
|
|
|
|
|
|
$name = pop @source; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
( $name, $description ); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub get_description { |
76
|
0
|
|
|
0
|
0
|
|
my ( $node, $source ) = @_; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my ( $name, $description ) = $node->get_name($source); |
79
|
0
|
|
|
|
|
|
$description; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |