line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Simple::DumpAsXML; |
2
|
30
|
|
|
30
|
|
1699821
|
use strict; |
|
30
|
|
|
|
|
273
|
|
|
30
|
|
|
|
|
1199
|
|
3
|
|
|
|
|
|
|
our $VERSION = '3.45'; |
4
|
30
|
|
|
30
|
|
15926
|
use Pod::Simple (); |
|
30
|
|
|
|
|
87
|
|
|
30
|
|
|
|
|
1135
|
|
5
|
30
|
|
|
30
|
|
1108
|
BEGIN {our @ISA = ('Pod::Simple')} |
6
|
|
|
|
|
|
|
|
7
|
30
|
|
|
30
|
|
193
|
use Carp (); |
|
30
|
|
|
|
|
63
|
|
|
30
|
|
|
|
|
647
|
|
8
|
30
|
|
|
30
|
|
14882
|
use Text::Wrap qw(wrap); |
|
30
|
|
|
|
|
74682
|
|
|
30
|
|
|
|
|
2132
|
|
9
|
|
|
|
|
|
|
|
10
|
30
|
50
|
|
30
|
|
19567
|
BEGIN { *DEBUG = \&Pod::Simple::DEBUG unless defined &DEBUG } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
150
|
|
|
150
|
1
|
54147
|
my $self = shift; |
14
|
150
|
|
|
|
|
520
|
my $new = $self->SUPER::new(@_); |
15
|
150
|
|
50
|
|
|
852
|
$new->{'output_fh'} ||= *STDOUT{IO}; |
16
|
150
|
|
|
|
|
519
|
$new->accept_codes('VerbatimFormatted'); |
17
|
150
|
|
|
|
|
468
|
$new->keep_encoding_directive(1); |
18
|
150
|
|
|
|
|
318
|
return $new; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _handle_element_start { |
24
|
|
|
|
|
|
|
# ($self, $element_name, $attr_hash_r) |
25
|
804
|
|
|
804
|
|
1383
|
my $fh = $_[0]{'output_fh'}; |
26
|
804
|
|
|
|
|
1207
|
my($key, $value); |
27
|
804
|
|
|
|
|
1010
|
DEBUG and print STDERR "++ $_[1]\n"; |
28
|
|
|
|
|
|
|
|
29
|
804
|
|
100
|
|
|
4003
|
print $fh ' ' x ($_[0]{'indent'} || 0), "<", $_[1]; |
30
|
|
|
|
|
|
|
|
31
|
804
|
|
|
|
|
1456
|
foreach my $key (sort keys %{$_[2]}) { |
|
804
|
|
|
|
|
3012
|
|
32
|
1054
|
100
|
|
|
|
2551
|
unless($key =~ m/^~/s) { |
33
|
925
|
100
|
100
|
|
|
3233
|
next if $key eq 'start_line' and $_[0]{'hide_line_numbers'}; |
34
|
651
|
|
|
|
|
1861
|
_xml_escape($value = $_[2]{$key}); |
35
|
651
|
|
|
|
|
1603
|
print $fh ' ', $key, '="', $value, '"'; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
804
|
|
|
|
|
2040
|
print $fh ">\n"; |
41
|
804
|
|
|
|
|
1458
|
$_[0]{'indent'}++; |
42
|
804
|
|
|
|
|
1566
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _handle_text { |
46
|
627
|
|
|
627
|
|
814
|
DEBUG and print STDERR "== \"$_[1]\"\n"; |
47
|
627
|
100
|
|
|
|
1522
|
if(length $_[1]) { |
48
|
626
|
|
|
|
|
1318
|
my $indent = ' ' x $_[0]{'indent'}; |
49
|
626
|
|
|
|
|
1084
|
my $text = $_[1]; |
50
|
626
|
|
|
|
|
1329
|
_xml_escape($text); |
51
|
626
|
|
|
|
|
1113
|
local $Text::Wrap::huge = 'overflow'; |
52
|
626
|
|
|
|
|
1618
|
$text = wrap('', $indent, $text); |
53
|
626
|
|
|
|
|
255531
|
print {$_[0]{'output_fh'}} $indent, $text, "\n"; |
|
626
|
|
|
|
|
2440
|
|
54
|
|
|
|
|
|
|
} |
55
|
627
|
|
|
|
|
2082
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _handle_element_end { |
59
|
804
|
|
|
804
|
|
1072
|
DEBUG and print STDERR "-- $_[1]\n"; |
60
|
804
|
|
|
|
|
2812
|
print {$_[0]{'output_fh'}} |
61
|
804
|
|
|
|
|
1096
|
' ' x --$_[0]{'indent'}, "", $_[1], ">\n"; |
62
|
804
|
|
|
|
|
1691
|
return; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _xml_escape { |
68
|
1277
|
|
|
1277
|
|
1923
|
foreach my $x (@_) { |
69
|
|
|
|
|
|
|
# Escape things very cautiously: |
70
|
1277
|
50
|
|
|
|
4835
|
if ($] ge 5.007_003) { |
71
|
1277
|
|
|
|
|
3696
|
$x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/''.(utf8::native_to_unicode(ord($1))).';'/eg; |
|
6872
|
|
|
|
|
16614
|
|
72
|
|
|
|
|
|
|
} else { # Is broken for non-ASCII platforms on early perls |
73
|
0
|
|
|
|
|
0
|
$x =~ s/([^-\n\t !\#\$\%\(\)\*\+,\.\~\/\:\;=\?\@\[\\\]\^_\`\{\|\}abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789])/''.(ord($1)).';'/eg; |
|
0
|
|
|
|
|
0
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
# Yes, stipulate the list without a range, so that this can work right on |
76
|
|
|
|
|
|
|
# all charsets that this module happens to run under. |
77
|
|
|
|
|
|
|
} |
78
|
1277
|
|
|
|
|
1772
|
return; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |