| 1 | 4 | ▶ | use strict; use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | package JSYNC; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | our $VERSION = '0.25'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | { | ||||||||||||||||||||||||||||||||||||||||||
| 8 | package JSYNC; | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | sub dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | my ($object, $config) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | $config ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$config ||= {}
MC/DC0%0/1
$config ||= {}
$config
Truth table50%1/2
A
A= $config
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | return JSYNC::Dumper->new(%$config)->dump($object); | |||||||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | my ($jsync) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 7 | return JSYNC::Loader->new->load($jsync); | |||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 55 | ▶ | sub info { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info: called CC=8 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 55 | my ($kind, $id, $class); | |||||||||||||||||||||||||||||||||||||||||
| 23 | 55 | ▶ | if (ref(\$_[0]) eq 'GLOB') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | (\$_[0] . "") =~ /^(?:(.+)=)?(GLOB)\((0x.*)\)$/ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | or die "Can't get info for '$_[0]'"; | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | ($kind, $id, $class) = ('glob', $3, $1 || ''); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$1 || ''
MC/DC0%0/1
$1 || ''
$1
Truth table0%0/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | elsif (not ref($_[0])) { | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 34 | $kind = 'scalar'; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 21 | ▶ | "$_[0]" =~ /^(?:(.+)=)?(HASH|ARRAY)\((0x.*)\)$/ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | or die "Can't get info for '$_[0]'"; | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 21 | ▶ | ($kind, $id, $class) = | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$1 || ''
MC/DC100%1/1
$1 || ''
$1
Truth table100%2/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | (($2 eq 'HASH' ? 'map' : 'seq'), $3, $1 || ''); | ||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 55 | return ($kind, $id, $class); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||||||||||||||||
| 42 | package JSYNC::Dumper; | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 7 | ▶ | sub new { bless { @_[1..$#_] }, $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 7 | ▶ | sub dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 7 | my ($self, $object) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 7 | $self->{anchor} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 7 | $self->{seen} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | my $graph = $self->represent($object); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 7 | my $json = 'JSON'->new()->canonical(); | |||||||||||||||||||||||||||||||||||||||||
| 52 | 7 | ▶ | $json->pretty() if $self->{pretty}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 7 | return $json->encode($graph); | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 32 | ▶ | sub represent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
represent: called CC=17 SCAR=38.0
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 32 | my ($self, $node) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 32 | my $seen = $self->{seen}; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 32 | my $graph; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 32 | my ($kind, $id, $class) = JSYNC::info($node); | |||||||||||||||||||||||||||||||||||||||||
| 61 | 32 | ▶ | if ($kind eq 'scalar') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 20 | ▶ | if (not defined $node) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 18 | return $self->escape($node); | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 12 | ▶ | if (my $info = $seen->{$id}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 3 | ▶ | if (not $info->{anchor}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | $info->{anchor} = $self->{anchor}++ . ""; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | ▶ | if ($info->{kind} eq 'map') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | $info->{graph}{'&'} = $info->{anchor}; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | unshift @{$info->{graph}}, '&' . $info->{anchor}; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 3 | return "*" . $info->{anchor}; | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 9 | my $tag = $self->resolve_to_tag($kind, $class); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 9 | ▶ | if ($kind eq 'seq') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 3 | $graph = []; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 3 | $seen->{$id} = { graph => $graph, kind => $kind }; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | @$graph = map { $self->represent($_) } @$node; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | ▶ | if ($tag) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | unshift @$graph, "!$tag"; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | elsif ($kind eq 'map') { | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 6 | $graph = {}; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 6 | $seen->{$id} = { graph => $graph, kind => $kind }; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 6 | for my $k (keys %$node) { | |||||||||||||||||||||||||||||||||||||||||
| 92 | 9 | $graph->{$self->represent($k)} = $self->represent($node->{$k}); | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 6 | ▶ | if ($tag) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | $graph->{'!'} = $tag; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # XXX glob should not be a kind. | ||||||||||||||||||||||||||||||||||||||||||
| 99 | elsif ($kind eq 'glob') { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $class ||= 'main'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$class ||= "main"
MC/DC0%0/1
$class ||= "main"
$class
Truth table0%0/2
A
A= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $graph = {}; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $graph->{PACKAGE} = $class; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $graph->{'!'} = '!perl/glob:'; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) { | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $value = *{$node}{$type}; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $value = $$value if $type eq 'SCALAR'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if (defined $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ($type eq 'IO') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my @stats = qw(device inode mode links uid gid rdev size | |||||||||||||||||||||||||||||||||||||||||
| 110 | atime mtime ctime blksize blocks); | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | undef $value; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $value->{stat} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | map {$value->{stat}{shift @stats} = $_} stat(*{$node}); | |||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $value->{fileno} = fileno(*{$node}); | |||||||||||||||||||||||||||||||||||||||||
| 115 | { | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | local $^W; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $value->{tell} = tell(*{$node}); | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $graph->{$type} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | # XXX [$id, $kind, $class]; | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | die "Can't represent kind '$kind'"; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 9 | return $graph; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 18 | ▶ | sub escape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
escape: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 18 | my ($self, $string) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 18 | $string =~ s/^(\.*[\!\&\*\%])/.$1/; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 18 | return $string; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 4 | my $perl_type = { | |||||||||||||||||||||||||||||||||||||||||
| 139 | map => 'hash', | ||||||||||||||||||||||||||||||||||||||||||
| 140 | seq => 'array', | ||||||||||||||||||||||||||||||||||||||||||
| 141 | scalar => 'scalar', | ||||||||||||||||||||||||||||||||||||||||||
| 142 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 9 | ▶ | sub resolve_to_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_to_tag: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 9 | my ($self, $kind, $class) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 9 | ▶ | return $class && "!perl/$perl_type->{$kind}\:$class"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$class && "!perl/$perl_type->{$kind}:$class"
MC/DC100%1/1
$class && "!perl/$perl_type->{$kind}:$class"
$class
Truth table100%2/2
A
A= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||||||||||||||||
| 150 | package JSYNC::Loader; | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 7 | ▶ | sub new { bless { @_[1..$#_] }, $_[0] } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 7 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 7 | my ($self, $jsync) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 7 | $self->{seen} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 7 | my $graph = 'JSON'->new()->decode($jsync); | |||||||||||||||||||||||||||||||||||||||||
| 158 | 7 | return $self->construct($graph); | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 23 | ▶ | sub construct { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
construct: called CC=15 SCAR=27.3
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 23 | my ($self, $graph) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 23 | my $seen = $self->{seen}; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 23 | my $node; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 23 | my ($kind, $id, $class) = JSYNC::info($graph); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 23 | ▶ | if ($kind eq 'scalar') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 14 | ▶ | if (not defined $graph) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 12 | ▶ | if ($graph =~ /^\*(\S+)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 3 | return $seen->{$1}; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 9 | return $self->unescape($graph); | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 9 | ▶ | if ($kind eq 'map') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 6 | $node = {}; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 6 | ▶ | if ($graph->{'&'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | my $anchor = $graph->{'&'}; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | delete $graph->{'&'}; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | $seen->{$anchor} = $node; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 6 | ▶ | if ($graph->{'!'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | my $class = $self->resolve_from_tag($graph->{'!'}); | |||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | delete $graph->{'!'}; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | bless $node, $class; | |||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 6 | for my $k (keys %$graph) { | |||||||||||||||||||||||||||||||||||||||||
| 189 | 9 | $node->{$self->unescape($k)} = $self->construct($graph->{$k}); | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | elsif ($kind eq 'seq') { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 3 | $node = []; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 3 | ▶ | if (@$graph and defined $graph->[0] and $graph->[0] =~ /^!(.*)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
@$graph and defined $graph->[0] and $graph->[0] =~ /^!(.*)$/
@$graph and defined $graph->[0]
MC/DC66%2/3
@$graph and defined $graph->[0] and $graph->[0] =~ /^!(.*)$/
@$graph
defined $graph->[0]
$graph->[0] =~ /^!(.*)$/
Truth table75%3/4
A and B and C
A= @$graphB= defined $graph->[0]C= $graph->[0] =~ /^!(.*)$/
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | my $class = $self->resolve_from_tag($1); | |||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | shift @$graph; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | bless $node, $class; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 3 | ▶ | if (@$graph and $graph->[0] and $graph->[0] =~ /^\&(\S+)$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
@$graph and $graph->[0] and $graph->[0] =~ /^\&(\S+)$/
@$graph and $graph->[0]
MC/DC0%0/3
@$graph and $graph->[0] and $graph->[0] =~ /^\&(\S+)$/
@$graph
$graph->[0]
$graph->[0] =~ /^\&(\S+)$/
Truth table50%2/4
A and B and C
A= @$graphB= $graph->[0]C= $graph->[0] =~ /^\&(\S+)$/
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $seen->{$1} = $node; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | shift @$graph; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 3 | @$node = map {$self->construct($_)} @$graph; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 9 | return $node; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 18 | ▶ | sub unescape { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unescape: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 18 | my ($self, $string) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 210 | 18 | $string =~ s/^\.(\.*[\!\&\*\%])/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 18 | return $string; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 2 | ▶ | sub resolve_from_tag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_from_tag: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | my ($self, $tag) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 2 | ▶ | $tag =~ m{^!perl/(?:hash|array|object):(\S+)$} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | or die "Can't resolve tag '$tag'"; | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 2 | return $1; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||