blib/lib/Data/TreeDumper/Renderer/ASCII.pm

filter: Statementstmt 59.2% 16 / 27 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 2 totaltotal 43.1% 19 / 44 CC 5 SCAR 26.7
CC
5
Cov
46%
RenderAsciiNode
30.0
GetRenderer
2.0
__ANON__
2.0
CRAP 14.5
↑ Summary
1 package Data::TreeDumper::Renderer::ASCII;
2  
3 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 require Exporter;
8  
9 1 our @ISA = qw(Exporter);
10  
11 1 our %EXPORT_TAGS = ( 'all' => [ qw() ] );
12  
13 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
14  
15 1 our @EXPORT = qw();
16  
17 1 our $VERSION = '0.03';
18  
19 #-------------------------------------------------------------------------------------------
20 sub GetRenderer
21 0 ▶{
Subroutine GetRenderer: not called CC=1 SCAR=6.9
Pod undocumented
22 # setup arguments can be passed to the renderer
23  
24 return
25 (
26 {
27 0 ▶ BEGIN => sub{"$_[0]\n"}
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 , NODE => \&RenderAsciiNode
29 0 ▶ , END => sub{''}
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 }
31 0 ) ;
32 }
33  
34  
35 #-------------------------------------------------------------------------------------------
36  
37 sub RenderAsciiNode
38 0 ▶{
Subroutine RenderAsciiNode: not called CC=5 SCAR=34.0
Pod undocumented
39 # a simple proof of concept, no config is handled
40  
41 my
42 (
43 0 $element
44 , $level
45 , $is_terminal
46 , $previous_level_separator
47 , $separator
48 , $element_name
49 , $element_value
50 , $td_address
51 , $address_link
52 , $perl_size
53 , $perl_address
54 , $setup
55 ) = @_ ;
56  
57 0 ▶$element_value = " = $element_value" if($element_value ne '') ;
Branch: 1 branch
BranchTrueFalseTotal
if $element_value ne "" 0 0 0
58  
59 0 my $address = $td_address ;
60 0 ▶$address .= "-> $address_link" if defined $address_link ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $address_link 0 0 0
61  
62 0 my $perl_data = '' ;
63 0 ▶$perl_data .= "<$perl_size> " if $perl_size ne '' ;
Branch: 1 branch
BranchTrueFalseTotal
if $perl_size ne "" 0 0 0
64 0 ▶$perl_data .= "$perl_address " if $perl_address ne '' ;
Branch: 1 branch
BranchTrueFalseTotal
if $perl_address ne "" 0 0 0
65  
66 0 "$previous_level_separator$separator $element_name$element_value [$address] $perl_data\n" ;
67 }
68
69 #-------------------------------------------------------------------------------------------
70  
71 1 1 ;
72  
73 __END__
↑ Summary