| 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Cisco::Reconfig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 9 | @EXPORT = qw(readconfig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | @EXPORT_OK = qw(readconfig stringconfig $minus_one_indent_rx); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 9 | $VERSION = '0.912'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 9 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 9 | ▶ | use Text::Tabs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 9 | ▶ | use Carp qw(verbose confess); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 9 | ▶ | use IO::File; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 9 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 9 | my $iostrings; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 9 | our $allow_minus_one_indent = qr/class /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 9 | our $allow_plus_one_indent = qr/service-policy |quit$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 9 | our $bad_indent_policy = 'DIE'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 9 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=8.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | eval " use IO::String "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 9 | ▶ | $iostrings = $@ ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 9 | my $debug_get = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 9 | my $debug_mget = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 9 | my $debug_set = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 9 | my $debug_context = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 9 | my $debug_text = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | ▶ | my $ddata = $debug_get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition35%5/14
$debug_get || $debug_mget || $debug_set || $debug_context || $debug_text || 0
$debug_get or $debug_mget or $debug_set or $debug_context or $debug_text
$debug_get or $debug_mget or $debug_set or $debug_context
$debug_get or $debug_mget or $debug_set
$debug_get or $debug_mget
MC/DC0%0/5
$debug_get || $debug_mget || $debug_set || $debug_context || $debug_text || 0
$debug_get
$debug_mget
$debug_set
$debug_context
$debug_text
Truth table16%1/6
A or B or C or D or E
A= $debug_getB= $debug_mgetC= $debug_setD= $debug_contextE= $debug_text
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | || $debug_mget | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | || $debug_set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | || $debug_context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | || $debug_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | || 0; # add debugging data to data structures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 9 | my $spec = qr{^ }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 9 | my $text = " text"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 9 | my $subs = " subs"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 9 | my $next = " next"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 9 | my $cntx = " cntx"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 9 | my $word = " word"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 9 | my $seqn = " seqn"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 9 | my $dupl = " dupl"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 9 | my $debg = " debg"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 9 | my $bloc = " bloc"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 9 | my $UNDEFDESC = "! undefined\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 9 | my $undef = bless { $debg => $UNDEFDESC, $text => '' }, __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 9 | my $dseq = "O0000000"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 9 | our $nonext; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 9 | my $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | my $fh; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | ▶ | 'bool' => \&defined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | '""' => \&text, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | 'fallback' => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | sub stringconfig | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringconfig: called CC=2 SCAR=9.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | ▶ | Carp::croak 'IO::Strings need to be installed to use "stringconfig"' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | . ' install it or use "readconfig" instead.' unless $iostrings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | readconfig(IO::String->new(join("\n",@_))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | sub readconfig | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readconfig: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 8 | my ($file) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 8 | ▶ | $fh = ref($file) ? $file : IO::File->new($file, "r"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 8 | $line = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 8 | return rc1(0, 'aaaa', $undef, "! whole enchalada\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | sub rc1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 92 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rc1: called CC=49 SCAR=41.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 92 | my ($indent, $seq, $parent, $dcon) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 92 | my $last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 92 | my $config = bless { $bloc => 1 }, __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 92 | ▶ | $config->{$debg} = "BLOCK:$dseq:$dcon" if $ddata; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 92 | $config->{$cntx} = $parent; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 92 | weaken $config->{$cntx}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 92 | $dseq++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 92 | my $prev; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | my $ciscobug; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 92 | ▶ | for(;$line;$prev = $line, $line = <$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 888 | $_ = $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 888 | s/^( *)//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 888 | my $in = length($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 888 | s/^(no +)//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 888 | my $no = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 888 | ▶ | if ($in > $indent) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 81 | ▶ | if ($last) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 79 | $last->{$subs} = rc1($in, "$last->{$seqn}aaa", $last, $line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 79 | undef $last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 79 | ▶ | redo if $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # This really shouldn't happen. But it does. It's a violation of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # the usual indentation rules. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # An exclamation marks a reset of the indentation to zero. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | ▶ | if ($indent + 1 == $in && $allow_plus_one_indent && $line =~ /^\s*$allow_plus_one_indent/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$indent + 1 == $in and $Cisco::Reconfig::allow_plus_one_indent and $line =~ /^\s*$Cisco::Reconfig::allow_plus_one_indent/
$indent + 1 == $in and $Cisco::Reconfig::allow_plus_one_indent
MC/DC0%0/3
$indent + 1 == $in and $Cisco::Reconfig::allow_plus_one_indent and $line =~ /^\s*$Cisco::Reconfig::allow_plus_one_indent/
$indent + 1 == $in
$Cisco::Reconfig::allow_plus_one_indent
$line =~ /^\s*$Cisco::Reconfig::allow_plus_one_indent/
Truth table25%1/4
A and B and C
A= $indent + 1 == $inB= $Cisco::Reconfig::allow_plus_one_indentC= $line =~ /^\s*$Cisco::Reconfig::allow_plus_one_indent/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $indent = $indent + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | redo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 2 | ▶ | if ($indent != 0 || ($prev ne "!\n" && $prev !~ /^!.*<removed>$/)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$indent != 0 or $prev ne "!\n" and not $prev =~ /^!.*<removed>$/
$prev ne "!\n" and not $prev =~ /^!.*<removed>$/
MC/DC0%0/3
$indent != 0 or $prev ne "!\n" and not $prev =~ /^!.*<removed>$/
$indent != 0
$prev ne "!\n"
not $prev =~ /^!.*<removed>$/
Truth table25%1/4
A or B and not(C)
A= $indent != 0B= $prev ne "!\n"C= not $prev =~ /^!.*<removed>$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ($bad_indent_policy eq 'IGNORE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | # okay then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } elsif ($bad_indent_policy eq 'WARN') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | warn "Unexpected indentation change <$.:$_>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | confess "Unexpected indentation change <$.:$_>"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | $ciscobug = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 2 | $indent = $in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } elsif ($in < $indent) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 90 | ▶ | if ($ciscobug && $in == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$ciscobug and $in == 0
MC/DC50%1/2
$ciscobug and $in == 0
$ciscobug
$in == 0
Truth table66%2/3
A and B
A= $ciscobugB= $in == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | $indent = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ▶ | } elsif ($last && $indent - 1 == $in && $allow_minus_one_indent && $line =~ /^\s*$allow_minus_one_indent/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
$last and $indent - 1 == $in and $Cisco::Reconfig::allow_minus_one_indent and $line =~ /^\s*$Cisco::Reconfig::allow_minus_one_indent/
$last and $indent - 1 == $in and $Cisco::Reconfig::allow_minus_one_indent
$last and $indent - 1 == $in
MC/DC75%3/4
$last and $indent - 1 == $in and $Cisco::Reconfig::allow_minus_one_indent and $line =~ /^\s*$Cisco::Reconfig::allow_minus_one_indent/
$last
$indent - 1 == $in
$Cisco::Reconfig::allow_minus_one_indent
$line =~ /^\s*$Cisco::Reconfig::allow_minus_one_indent/
Truth table80%4/5
A and B and C and D
A= $lastB= $indent - 1 == $inC= $Cisco::Reconfig::allow_minus_one_indentD= $line =~ /^\s*$Cisco::Reconfig::allow_minus_one_indent/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 5 | ▶ | confess unless $last->{$seqn}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 5 | $last->{$subs} = rc1($in, "$last->{$seqn}aaa", $last, $line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 5 | undef $last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 5 | ▶ | redo if $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 83 | return $config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 722 | ▶ | next if /^$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 716 | ▶ | next if /^\s*!/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 551 | my $context = $config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 551 | my (@x) = split; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 551 | my $owords = @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 551 | ▶ | while (@x && ref $context->{$x[0]}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@x and ref $$context{$x[0]}
MC/DC100%2/2
@x and ref $$context{$x[0]}
@x
ref $$context{$x[0]}
Truth table100%3/3
A and B
A= @xB= ref $$context{$x[0]}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 432 | $context = $context->{$x[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 432 | shift @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 551 | ▶ | if (! @x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # A duplicate line. Not fun. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # As far as we know this can only occur as a remark inside | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # filter list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # Q: what's the point of keeping track of these? Need to be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # able to accurately dump filter list definitions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | $context->{$dupl} = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 15 | ▶ | unless $context->{$dupl}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | my $n = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $ddata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | ? ( $debg => "$dseq:DUP:$line", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 15 | ▶ | $word => $context->{$word}, ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | }, __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 15 | $dseq++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 15 | push(@{$context->{$dupl}}, $n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 15 | $context = $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } elsif (defined $context->{$x[0]}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | confess "already $.: '$x[0]' $line"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 551 | ▶ | while (@x) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1468 | my $x = shift @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1468 | ▶ | confess unless defined $x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1468 | ▶ | confess unless defined $dseq; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1468 | ▶ | $line = "" unless defined $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1468 | ▶ | $context = $context->{$x} = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | $ddata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | ? ( $debg => "$dseq:$x:$line", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | $word => $x, ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | }, __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1468 | $dseq++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 551 | $context->{$seqn} = $seq++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 551 | $context->{$text} = $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 551 | ▶ | confess if $context->{$cntx}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 551 | $context->{$cntx} = $config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 551 | weaken $context->{$cntx}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 551 | ▶ | unless ($nonext) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 551 | ▶ | if ($last) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 392 | $last->{$next} = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 392 | weaken $last->{$next}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 159 | $config->{$next} = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 159 | weaken $config->{$next}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 551 | $last = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 551 | ▶ | if ($line && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$line and ($line =~ /(\^C)/ and not $line =~ /\^C.*\^C/) or $line =~ /banner [a-z\-]+ ((?!\^C).+)/
$line and ($line =~ /(\^C)/ and not $line =~ /\^C.*\^C/)
$line =~ /(\^C)/ and not $line =~ /\^C.*\^C/
MC/DC75%3/4
$line and ($line =~ /(\^C)/ and not $line =~ /\^C.*\^C/) or $line =~ /banner [a-z\-]+ ((?!\^C).+)/
$line
$line =~ /(\^C)/
not $line =~ /\^C.*\^C/
$line =~ /banner [a-z\-]+ ((?!\^C).+)/
Truth table57%4/7
A and B and not(C) or D
A= $lineB= $line =~ /(\^C)/C= not $line =~ /\^C.*\^C/D= $line =~ /banner [a-z\-]+ ((?!\^C).+)/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | ($line =~ /(\^C)/ && $line !~ /\^C.*\^C/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ($line =~ /banner [a-z\-]+ ((?!\^C).+)/)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # big special case for banners 'cause they don't follow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # normal indenting rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 8 | ▶ | die unless defined $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 8 | my $sep = qr/\Q$1\E/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 8 | my $sub = $last->{$subs} = bless { $bloc => 1 }, __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 8 | $sub->{$cntx} = $last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 8 | weaken $sub->{$cntx}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 8 | my $subnull = $sub->{''} = bless { $bloc => 1, $dupl => [] }, __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 8 | $subnull->{$cntx} = $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 8 | weaken $subnull->{$cntx}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 8 | for(;;) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 48 | $line = <$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 48 | ▶ | last unless $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 48 | ▶ | my $l = bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | $ddata ? ( $debg => "$dseq:DUP:$line" ) : (), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | }, __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 48 | $dseq++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 48 | $l->{$seqn} = $seq++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 48 | $l->{$text} = $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 48 | $l->{$cntx} = $subnull; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 48 | weaken($l->{$cntx}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 48 | push(@{$subnull->{$dupl}}, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 48 | ▶ | last if $line =~ /$sep[\r]?$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 8 | ▶ | warn "parse probably failed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$line and $line =~ /${sep}[\r]?$/
MC/DC0%0/2
$line and $line =~ /${sep}[\r]?$/
$line
$line =~ /${sep}[\r]?$/
Truth table33%1/3
A and B
A= $lineB= $line =~ /${sep}[\r]?$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | unless $line && $line =~ /$sep[\r]?$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 9 | return $config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | #sub word { $_[0]->{$word} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 79 | ▶ | sub block { $_[0]->{$bloc} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
block: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 13143 | ▶ | sub seqn { $_[0]->{$seqn} || $_[0]->endpt->{$seqn} || confess }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seqn: called CC=3 SCAR=12.0
Pod
undocumented
Branch: 1 branch
Condition66%2/3
$_[0]{$seqn} or $_[0]->endpt->{$seqn}
MC/DC0%0/2
$_[0]{$seqn} or $_[0]->endpt->{$seqn}
$_[0]{$seqn}
$_[0]->endpt->{$seqn}
Truth table66%2/3
A or B
A= $_[0]{$seqn}B= $_[0]->endpt->{$seqn}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 225 | ▶ | sub subs { $_[0]->{$subs} || $_[0]->zoom->{$subs} || $undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subs: called CC=3 SCAR=11.1
Pod
documented
Branch: 1 branch
Condition66%2/3
$_[0]{$subs} or $_[0]->zoom->{$subs}
MC/DC50%1/2
$_[0]{$subs} or $_[0]->zoom->{$subs}
$_[0]{$subs}
$_[0]->zoom->{$subs}
Truth table66%2/3
A or B
A= $_[0]{$subs}B= $_[0]->zoom->{$subs}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 28 | ▶ | sub next { $_[0]->{$next} || $_[0]->zoom->{$next} || $undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=3 SCAR=11.1
Pod
documented
Branch: 1 branch
Condition66%2/3
$_[0]{$next} or $_[0]->zoom->{$next}
MC/DC50%1/2
$_[0]{$next} or $_[0]->zoom->{$next}
$_[0]{$next}
$_[0]->zoom->{$next}
Truth table66%2/3
A or B
A= $_[0]{$next}B= $_[0]->zoom->{$next}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | #sub undefined { $_[0] eq $undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | #sub defined { $_[0] ne $undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 41506 | ▶ | sub defined { $_[0]->{$debg} ? $_[0]->{$debg} ne $UNDEFDESC : 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
defined: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | sub destroy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
destroy: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | warn "Cisco::Reconfig::destroy is deprecated"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | sub single | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 42 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
single: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 42 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 42 | ▶ | return $self if defined $self->{$text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 17 | my (@p) = grep(! /$spec/o, keys %$self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 17 | ▶ | return undef if @p > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 16 | ▶ | return $self unless @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 16 | ▶ | return $self->{$p[0]}->single || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$$self{$p[0]}->single || $self
MC/DC0%0/2
$$self{$p[0]}->single || $self
$$self{$p[0]}->single
$self
Truth table33%1/3
A || B
A= $$self{$p[0]}->singleB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | sub kids | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
kids: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 15 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 15 | ▶ | return $self if ! $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 15 | my (@p) = $self->sortit(grep(! /$spec/o, keys %$self)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 15 | ▶ | return $self if ! @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 3 | return (map { $self->{$_} } @p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | sub zoom | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 400 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
zoom: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 400 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 400 | ▶ | return $self if defined $self->{$text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 235 | my (@p) = $self->sortit(grep(! /$spec/o, keys %$self)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 235 | ▶ | return $self if @p > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 71 | ▶ | return $self unless @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 71 | return $self->{$p[0]}->zoom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | sub endpt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 39558 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
endpt: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 39558 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 39558 | ▶ | return $self if ! $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 39558 | my (@p) = grep(! /$spec/o, keys %$self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 39558 | ▶ | return $self if defined($self->{$text}) && ! @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->{$text} and not @p
MC/DC100%2/2
defined $self->{$text} and not @p
defined $self->{$text}
not @p
Truth table100%3/3
A and not(B)
A= defined $self->{$text}B= not @p
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 28293 | ▶ | confess unless @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 28293 | return $self->{$p[0]}->endpt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | sub text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 429 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text: called CC=8 SCAR=21.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 429 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 429 | ▶ | return '' unless $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 418 | ▶ | if (defined $self->{$text}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | return $debug_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ? $self->{$word} . " " . $self->{$text} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 133 | ▶ | : $self->{$text}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 285 | my (@p) = $self->sortit(grep(! /$spec/o, keys %$self)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 285 | ▶ | if (@p > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # This is nasty because the lines may not be ordered | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # in the tree-hiearchy used by Cisco::Reconfig | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 9 | my %temp = map { $self->{$_}->sequenced_text(0) } @p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 9 | return join('', map { $temp{$_} } sort keys %temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } elsif ($self->{$dupl}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | return join('', map { $_->{$word} . " " . $_->{$text} } @{$self->{$dupl}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | if $debug_text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 6 | return join('', map { $_->{$text} } @{$self->{$dupl}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 270 | ▶ | confess unless @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 270 | return $self->{$p[0]}->text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | sub sequenced_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 282 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sequenced_text: called CC=10 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 282 | my ($self, $all) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 282 | my @t = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 282 | ▶ | if (defined $self->{$text}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | push(@t, $debug_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | ? ($self->seqn => $self->{$word} . " " . $self->{$text}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 98 | ▶ | : ($self->seqn => $self->{$text})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 282 | ▶ | if (exists $self->{$dupl}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | push (@t, $debug_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ? map { $_->seqn => $_->{$word} . " " . $_->{$text} } @{$self->{$dupl}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | ▶ | : map { $_->seqn => $_->{$text} } @{$self->{$dupl}}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 282 | my (@p) = $self->sortit(grep(! /$spec/o, keys %$self)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 282 | ▶ | if (@p) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # This is nasty because the lines may not be ordered | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # in the tree-hiearchy used by Cisco::Reconfig | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 190 | return (@t, map { $self->{$_}->sequenced_text($all) } @p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | push(@t, $self->{$subs}->sequenced_text($all)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 92 | ▶ | if $all && $self->{$subs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$all and $self->{$subs}
MC/DC0%0/2
$all and $self->{$subs}
$all
$self->{$subs}
Truth table66%2/3
A and B
A= $allB= $self->{$subs}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 92 | ▶ | return @t if @t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | confess unless @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | return $self->{$p[0]}->sequenced_text($all); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | sub alltext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alltext: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 6 | ▶ | return '' unless $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 5 | my %temp = $self->sequenced_text(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 5 | return join('', map { $temp{$_} } sort keys %temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | sub chomptext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chomptext: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $t = $self->text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | chomp($t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | return $t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | sub returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
returns: called CC=5 SCAR=17.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 16 | my (@o) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 16 | for my $o (@o) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 55 | ▶ | $o .= "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $o and not $o =~ /\n$/
MC/DC0%0/2
defined $o and not $o =~ /\n$/
defined $o
not $o =~ /\n$/
Truth table33%1/3
A and not(B)
A= defined $oB= not $o =~ /\n$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | if defined($o) && $o !~ /\n$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 16 | ▶ | return $o[0] unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 16 | return @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | sub openangle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
openangle: called CC=4 SCAR=14.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 9 | ▶ | my (@l) = grep(defined && /\S/, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $_ && /\S/
MC/DC0%0/2
defined $_ && /\S/
defined $_
/\S/
Truth table33%1/3
A && B
A= defined $_B= /\S/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 9 | my $x = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 9 | for my $l (@l) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 12 | substr($l, 0, 0) = (' ' x $x++); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 9 | ▶ | return $l[0] unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 9 | return @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | sub closeangle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
closeangle: called CC=4 SCAR=14.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 11 | ▶ | my (@l) = grep(defined && /\S/, @_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $_ && /\S/
MC/DC0%0/2
defined $_ && /\S/
defined $_
/\S/
Truth table33%1/3
A && B
A= defined $_B= /\S/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 11 | my $x = $#l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 11 | for my $l (@l) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 14 | substr($l, 0, 0) = (' ' x $x--); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 11 | ▶ | return $l[0] unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 11 | return @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | sub context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 127 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
context: called CC=4 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | defined($_[0]->{$cntx}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | ? $_[0]->{$cntx} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 127 | ▶ | : $_[0]->endpt->{$cntx} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$_[0]->endpt->{$cntx} or $_[0] ? confess("$_[0]") : $undef
MC/DC0%0/2
$_[0]->endpt->{$cntx} or $_[0] ? confess("$_[0]") : $undef
$_[0]->endpt->{$cntx}
$_[0] ? confess("$_[0]") : $undef
Truth table33%1/3
A or B
A= $_[0]->endpt->{$cntx}B= $_[0] ? confess("$_[0]") : $undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | || ($_[0] ? confess "$_[0]" : $undef) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # interface Loopback7 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # ip address x y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | sub setcontext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 74 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setcontext: called CC=6 SCAR=18.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 74 | my ($self, @extras) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 74 | ▶ | print STDERR "\nSETCONTEXT\n" if $debug_context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 74 | ▶ | unless ($self->block) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 10 | ▶ | print STDERR "\nNOT_A_BLOCK $self->{$debg}\n" if $debug_context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 10 | $self = $self->context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | printf STDERR "\nSELF %sCONTEXT %sCCONTEXT %sEXTRAS$#extras @extras\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | $self->{$debg}, $self->context->{$debg}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 74 | ▶ | $self->context->context->{$debg} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | if $debug_context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 74 | my $x = $self->context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | return (grep defined, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | $x->context->setcontext, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 74 | ▶ | trim($x->zoom->{$text}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | @extras) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | if $x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 38 | return @extras; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | sub contextcount | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 27 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contextcount: called CC=3 SCAR=11.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 27 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 27 | my (@a) = $self->setcontext(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 27 | ▶ | printf STDERR "CONTEXTCOUNT = %d\n", scalar(@a) if $debug_context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | print STDERR map { "CC: $_\n" } @a if $debug_context; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 27 | return scalar(@a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | sub unsetcontext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unsetcontext: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 11 | return (("exit") x $self->contextcount(@_)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | sub teql | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 27 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
teql: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 27 | my ($self, $b) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 27 | my $a = $self->text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 27 | $a =~ s/^\s+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 27 | $a =~ s/^ //; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 27 | $a =~ s/ $//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 27 | chomp($a); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 27 | $b =~ s/^\s+/ /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 27 | $b =~ s/^ //; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 27 | $b =~ s/ $//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 27 | chomp($b); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 27 | return $a eq $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | sub set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: called CC=48 SCAR=39.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 16 | my $new = pop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 16 | my (@designators) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | #my ($self, $designator, $new) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 16 | ▶ | print STDERR "\nSET\n" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 16 | ▶ | return undef unless $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 16 | my $old; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | #my @designators; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 16 | ▶ | print STDERR "\nSELF $self->{$debg}" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # move into the block if possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 16 | ▶ | $self = $self->subs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | if $self->subs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 16 | ▶ | print STDERR "\nSELF $self->{$debg}" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | #if (ref $designator eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # @designators = @$designator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | # $old = $self->get(@designators); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | # $designator = pop(@designators); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | #} elsif ($designator) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | # $old = $self->get($designator); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | #} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # $old = $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 16 | my $designator; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 16 | ▶ | if (@designators) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 10 | $old = $self->get(@designators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 10 | $designator = pop(@designators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 6 | $old = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 16 | ▶ | print STDERR "\nOLD $old->{$debg}" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 16 | my (@lines) = expand(grep(/./, split(/\n/, $new))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 16 | ▶ | if ($lines[0] =~ /^(\s+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 11 | my $ls = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 11 | my $m = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 11 | ▶ | map { substr($_, 0, length($ls)) eq $ls or $m = 0 } @lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
substr($_, 0, length $ls) eq $ls || ($m = 0)
MC/DC0%0/1
substr($_, 0, length $ls) eq $ls || ($m = 0)
substr($_, 0, length $ls) eq $ls
Truth table50%1/2
A
A= substr($_, 0, length $ls) eq $ls
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 11 | ▶ | map { substr($_, 0, length($ls)) = '' } @lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | if $m; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 16 | my $indent = (' ' x $self->contextcount(@designators)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 16 | for $_ (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 56 | s/(\S)\s+/$1 /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 56 | s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 56 | ▶ | $_ = 'exit' if /^\s*!\s*$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 56 | $_ = "$indent$_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 16 | ▶ | print STDERR "SET TO {\n@lines\n}\n" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 16 | my $desig = shift(@lines); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 16 | my @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 16 | ▶ | undef $old | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | if ! $old; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 16 | ▶ | if (! $old) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1 | ▶ | print STDERR "NO OLD\n" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 1 | push(@o, openangle($self->setcontext(@designators))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | push(@o, $desig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | ▶ | } elsif (! $designator && ! looks_like_a_block($desig,@lines)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$designator || looks_like_a_block($desig, @lines)
MC/DC100%2/2
$designator || looks_like_a_block($desig, @lines)
$designator
looks_like_a_block($desig, @lines)
Truth table100%3/3
A || B
A= $designatorB= looks_like_a_block($desig, @lines)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 5 | ▶ | if ($self->block && $self->context) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->block and $self->context
MC/DC0%0/2
$self->block and $self->context
$self->block
$self->context
Truth table33%1/3
A and B
A= $self->blockB= $self->context
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 2 | unshift(@lines, $desig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 2 | $old = $self->context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 2 | undef $desig; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 3 | unshift(@lines, $desig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 3 | ▶ | print STDERR "IN NASTY BIT\n" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | # this is a messy situation: we've got a random | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | # block of stuff to set inside a random block. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | # In theorey we could avoid the die, I'll leave | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | # that as an exercise for the reader. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 3 | ▶ | confess "You cannot set nested configurations with set(undef, \$config) -- use a designator on the set method" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | if grep(/^$indent\s/, @lines); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 3 | my (@t) = split(/\n/, $self->text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 3 | my (%t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 3 | @t{strim(@t)} = @t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 3 | ▶ | while (@lines) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 23 | my $l = strim(shift(@lines)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 23 | ▶ | if ($t{$l}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 22 | delete $t{$l}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 1 | push(@o, "$indent$l"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 3 | for my $k (keys %t) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 2 | unshift(@o, iinvert($indent, $k)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 3 | ▶ | unshift(@o, $self->setcontext) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | if @o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } elsif ($old->teql($desig)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 4 | ▶ | print STDERR "DESIGNATOR EQUAL\n" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | # okay | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 6 | ▶ | print STDERR "DESIGNATOR DIFERENT\n" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 6 | push(@o, openangle($self->setcontext(@designators))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 6 | ▶ | if (defined $designator) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 5 | push(@o, iinvert($indent, $designator)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 1 | push(@o, iinvert($indent, split(/\n/, $self->text))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 6 | push(@o, $desig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 16 | ▶ | if (@lines) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 6 | ▶ | if ($old && ! @o && $old->subs && $old->subs->next) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
$old and not @o and $old->subs and $old->subs->next
$old and not @o and $old->subs
$old and not @o
MC/DC0%0/4
$old and not @o and $old->subs and $old->subs->next
$old
not @o
$old->subs
$old->subs->next
Truth table20%1/5
A and not(B) and C and D
A= $oldB= not @oC= $old->subsD= $old->subs->next
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 5 | ▶ | print STDERR "OLD= $old->{$debg}" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 5 | my $ok = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 5 | my $f = $old->subs->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 5 | ▶ | print STDERR "F= $f->{$debg}" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 5 | for my $l (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 19 | ▶ | next if $l =~ /^\s*exit\s*$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 17 | ▶ | next if $f->teql($l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 2 | ▶ | print STDERR "LINE DIFF ON $l\n" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 2 | $ok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 2 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } continue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 17 | $f = $f->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 17 | ▶ | print STDERR "F= $f->{$debg}" if $debug_set; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 5 | ▶ | if (! $ok || $f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $ok or $f
MC/DC0%0/2
not $ok or $f
not $ok
$f
Truth table33%1/3
not(A) or B
A= not $okB= $f
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 2 | push(@o, openangle($self->setcontext(@designators))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 2 | push(@o, iinvert($indent, $designator)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 2 | push(@o, $desig); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 6 | ▶ | push(@o, @lines) if @o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 16 | @o = grep(defined, @o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 16 | ▶ | push(@o, closeangle($self->unsetcontext(@designators))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | if @o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 16 | ▶ | return join('', returns(@o)) unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | return returns(@o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | sub looks_like_a_block | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
looks_like_a_block: called CC=5 SCAR=18.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 6 | my ($first, @l) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 6 | my $last = pop(@l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 6 | ▶ | return 1 if ! defined $last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 5 | ▶ | return 0 if grep(/^\S/, @l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 5 | ▶ | return 0 if $first =~ /^\s/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | return 0 if $last =~ /^\s/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | sub iinvert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iinvert: called CC=6 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 10 | my ($indent,@l) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 10 | ▶ | confess unless @l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 10 | for $_ (@l) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 10 | ▶ | next unless defined; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 9 | ▶ | s/^\s*no /$indent/ or s/^\s*(\S)/${indent}no $1/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 10 | ▶ | return $l[0] unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 10 | return @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | sub all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
all: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 9 | my ($self, $regex) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 9 | $self = $self->zoom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 9 | ▶ | return (map { $self->{$_} } $self->sortit(grep(/$regex/ && ! /$spec/o, keys %$self))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/$regex/ && !/$spec/o
MC/DC50%1/2
/$regex/ && !/$spec/o
/$regex/
!/$spec/o
Truth table66%2/3
A && not(B)
A= /$regex/B= !/$spec/o
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | if $regex; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 6 | return (map { $self->{$_} } $self->sortit(grep(! /$spec/o, keys %$self))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | sub get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 153 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=20 SCAR=32.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 153 | my ($self, @designators) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 153 | ▶ | return $self->mget(@designators) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
wantarray and @designators > 1
MC/DC100%2/2
wantarray and @designators > 1
wantarray
@designators > 1
Truth table100%3/3
A and B
A= wantarrayB= @designators > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | if wantarray && @designators > 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 152 | ▶ | print STDERR "\nGET <@designators> $self->{$debg}" if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 152 | ▶ | return $self unless $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 152 | my $zoom = $self->zoom->subs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 152 | ▶ | $self = $zoom if $zoom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 152 | ▶ | print STDERR "\nZOOMSUB $self->{$debg}" if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 152 | ▶ | while (@designators) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 175 | my $designator = shift(@designators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | # $self = $self->zoom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | # $self = $self->single || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 175 | ▶ | print STDERR "\nDESIGNATOR: $designator. ZOOMED: $self->{$debg}\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 175 | for my $d (split(' ',$designator)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 272 | ▶ | print STDERR "\nDO WE HAVE A: $d?\n" if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 272 | ▶ | return $undef unless $self->{$d}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 258 | $self = $self->{$d}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 258 | ▶ | print STDERR "\nWE DO: $self->{$debg}\n" if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 161 | ▶ | last unless @designators; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 23 | ▶ | if ($self->single) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 23 | $self = $self->subs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 23 | ▶ | print STDERR "\nSINGLETON: $self->{$debg}\n" if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | print STDERR "\nNOT SINGLE\n" if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | return $undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 138 | ▶ | print STDERR "\nDONE\n" if $debug_get; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 138 | ▶ | if (wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 15 | $self = $self->zoom; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 15 | my (@k) = $self->kids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 15 | ▶ | return @k if @k; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 123 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | sub strim | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 26 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
strim: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 26 | my (@l) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 26 | for $_ (@l) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 47 | s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 47 | s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 47 | s/\n$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 26 | ▶ | return $l[0] unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 3 | return @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | sub trim | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 36 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trim: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 36 | my (@l) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 36 | for $_ (@l) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 36 | s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 36 | s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 36 | ▶ | return $l[0] unless wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 36 | return @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | sub display | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
display: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | my @o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | push(@o, $self->setcontext); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | push(@o, trim($self->single->{$text})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | ▶ | if $self->single && $self->single->{$text} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->single and $self->single->{$text} and $self->subs->undefined
$self->single and $self->single->{$text}
MC/DC0%0/3
$self->single and $self->single->{$text} and $self->subs->undefined
$self->single
$self->single->{$text}
$self->subs->undefined
Truth table0%0/4
A and B and C
A= $self->singleB= $self->single->{$text}C= $self->subs->undefined
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | && $self->subs->undefined; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 0 | ▶ | push(@o, "! the whole enchalada") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | if $self->context->undefined; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | my (@r) = returns(openangle(@o)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | return @r if wantarray; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | return join('', @r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | sub callerlevels | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callerlevels: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 15 | my $n = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 15 | ▶ | 1 while caller($n++); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 15 | return $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | sub mget | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mget: called CC=9 SCAR=23.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 15 | my ($self, @designators) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 15 | my $cl = callerlevels; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 15 | my @newset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 15 | ▶ | if (@designators > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 1 | ▶ | print STDERR "\nGET$cl $designators[0]----------\n" if $debug_mget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 1 | my (@set) = $self->get(shift @designators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 1 | for my $item (@set) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 14 | ▶ | print STDERR "\nMGET$cl $item ----------\n" if $debug_mget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 14 | ▶ | print STDERR "\nMGET$cl $item->{$debg}\n" if $debug_mget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 14 | my (@got) = $item->mget(@designators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | print STDERR map { "\nRESULTS$cl: $_->{$debg}\n" } @got | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | if $debug_mget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 14 | push(@newset, @got); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 14 | ▶ | print STDERR "\nxGET$cl $designators[0] -------\n" if $debug_mget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 14 | (@newset) = $self->get(shift @designators); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | print STDERR map { "\nxRESULTS$cl: $_->{$debg}\n" } @newset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | if $debug_mget; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 15 | return @newset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | sub sortit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 826 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sortit: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 826 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 826 | return sort { $self->{$a}->seqn cmp $self->{$b}->seqn } @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||