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