line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
require 5; |
3
|
|
|
|
|
|
|
package Pod::Simple::DumpAsText; |
4
|
|
|
|
|
|
|
$VERSION = '3.42'; |
5
|
2
|
|
|
2
|
|
1065
|
use Pod::Simple (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
60
|
|
6
|
2
|
|
|
2
|
|
76
|
BEGIN {@ISA = ('Pod::Simple')} |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
40
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
11
|
use Carp (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
57
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
50
|
|
2
|
|
1283
|
BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
16
|
2
|
|
|
|
|
10
|
my $new = $self->SUPER::new(@_); |
17
|
2
|
|
50
|
|
|
11
|
$new->{'output_fh'} ||= *STDOUT{IO}; |
18
|
2
|
|
|
|
|
8
|
$new->accept_codes('VerbatimFormatted'); |
19
|
2
|
|
|
|
|
7
|
$new->keep_encoding_directive(1); |
20
|
2
|
|
|
|
|
3
|
return $new; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _handle_element_start { |
26
|
|
|
|
|
|
|
# ($self, $element_name, $attr_hash_r) |
27
|
2
|
|
|
2
|
|
4
|
my $fh = $_[0]{'output_fh'}; |
28
|
2
|
|
|
|
|
3
|
my($key, $value); |
29
|
2
|
|
|
|
|
3
|
DEBUG and print STDERR "++ $_[1]\n"; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
100
|
|
|
12
|
print $fh ' ' x ($_[0]{'indent'} || 0), "++", $_[1], "\n"; |
32
|
2
|
|
|
|
|
4
|
$_[0]{'indent'}++; |
33
|
2
|
|
|
|
|
3
|
while(($key,$value) = each %{$_[2]}) { |
|
4
|
|
|
|
|
22
|
|
34
|
2
|
50
|
|
|
|
7
|
unless($key =~ m/^~/s) { |
35
|
2
|
50
|
33
|
|
|
9
|
next if $key eq 'start_line' and $_[0]{'hide_line_numbers'}; |
36
|
0
|
|
|
|
|
0
|
_perly_escape($key); |
37
|
0
|
|
|
|
|
0
|
_perly_escape($value); |
38
|
|
|
|
|
|
|
printf $fh qq{%s \\ "%s" => "%s"\n}, |
39
|
0
|
|
0
|
|
|
0
|
' ' x ($_[0]{'indent'} || 0), $key, $value; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
2
|
|
|
|
|
5
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _handle_text { |
46
|
1
|
|
|
1
|
|
15
|
DEBUG and print STDERR "== \"$_[1]\"\n"; |
47
|
|
|
|
|
|
|
|
48
|
1
|
50
|
|
|
|
5
|
if(length $_[1]) { |
49
|
1
|
|
|
|
|
3
|
my $indent = ' ' x $_[0]{'indent'}; |
50
|
1
|
|
|
|
|
2
|
my $text = $_[1]; |
51
|
1
|
|
|
|
|
4
|
_perly_escape($text); |
52
|
1
|
|
|
|
|
1
|
$text =~ # A not-totally-brilliant wrapping algorithm: |
53
|
|
|
|
|
|
|
s/( |
54
|
|
|
|
|
|
|
[^\n]{55} # Snare some characters from a line |
55
|
|
|
|
|
|
|
[^\n\ ]{0,50} # and finish any current word |
56
|
|
|
|
|
|
|
) |
57
|
|
|
|
|
|
|
\ {1,10}(?!\n) # capture some spaces not at line-end |
58
|
|
|
|
|
|
|
/$1"\n$indent . "/gx # => line-break here |
59
|
|
|
|
|
|
|
; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
2
|
print {$_[0]{'output_fh'}} $indent, '* "', $text, "\"\n"; |
|
1
|
|
|
|
|
4
|
|
62
|
|
|
|
|
|
|
} |
63
|
1
|
|
|
|
|
3
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub _handle_element_end { |
67
|
2
|
|
|
2
|
|
3
|
DEBUG and print STDERR "-- $_[1]\n"; |
68
|
2
|
|
|
|
|
8
|
print {$_[0]{'output_fh'}} |
69
|
2
|
|
|
|
|
2
|
' ' x --$_[0]{'indent'}, "--", $_[1], "\n"; |
70
|
2
|
|
|
|
|
3
|
return; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _perly_escape { |
76
|
1
|
|
|
1
|
|
3
|
foreach my $x (@_) { |
77
|
1
|
|
|
|
|
4
|
$x =~ s/([^\x00-\xFF])/sprintf'\x{%X}',ord($1)/eg; |
|
0
|
|
|
|
|
0
|
|
78
|
|
|
|
|
|
|
# Escape things very cautiously: |
79
|
1
|
|
|
|
|
2
|
$x =~ s/([^-\n\t \&\<\>\'!\#\%\(\)\*\+,\.\/\:\;=\?\~\[\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/sprintf'\x%02X',ord($1)/eg; |
|
0
|
|
|
|
|
0
|
|
80
|
|
|
|
|
|
|
} |
81
|
1
|
|
|
|
|
2
|
return; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |