| 1 | package IO::Compress::Base::Common; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 130 | ▶ | use strict ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 130 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 130 | ▶ | use bytes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 130 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 130 | ▶ | use Scalar::Util qw(blessed readonly); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 130 | ▶ | use File::GlobMapper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 130 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 130 | our ($VERSION, @ISA, @EXPORT, %EXPORT_TAGS, $HAS_ENCODE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 130 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 130 | $VERSION = '2.225'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 130 | @EXPORT = qw( isaFilehandle isaFilename isaScalar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | whatIsInput whatIsOutput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | isaFileGlobString cleanFileGlobString oneTarget | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | setBinModeInput setBinModeOutput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ckInOutParams | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | createSelfTiedObject | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | isGeMax32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | MAX32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | WANT_CODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | WANT_EXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | WANT_UNDEF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | WANT_HASH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | STATUS_OK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | STATUS_ENDSTREAM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | STATUS_EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | STATUS_ERROR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 130 | %EXPORT_TAGS = ( Status => [qw( STATUS_OK | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | STATUS_ENDSTREAM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | STATUS_EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | STATUS_ERROR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | )]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 130 | ▶ | use constant STATUS_OK => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 130 | ▶ | use constant STATUS_ENDSTREAM => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 130 | ▶ | use constant STATUS_EOF => 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 130 | ▶ | use constant STATUS_ERROR => -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 130 | ▶ | use constant MAX16 => 0xFFFF ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 130 | ▶ | use constant MAX32 => 0xFFFFFFFF ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 130 | ▶ | use constant MAX32cmp => 0xFFFFFFFF + 1 - 1; # for 5.6.x on 32-bit need to force an non-IV value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | sub isGeMax32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 184 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isGeMax32: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 184 | return $_[0] >= MAX32cmp ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | sub hasEncode() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 20 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hasEncode: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 20 | ▶ | if (! defined $HAS_ENCODE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 5 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 5 | require Encode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 5 | Encode->import(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 5 | ▶ | $HAS_ENCODE = $@ ? 0 : 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 20 | return $HAS_ENCODE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | sub getEncoding($$$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 20 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getEncoding: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 20 | my $obj = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 20 | my $class = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 20 | my $want_encoding = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 20 | ▶ | $obj->croakError("$class: Encode module needed to use -Encode") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | if ! hasEncode(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 20 | my $encoding = Encode::find_encoding($want_encoding); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 20 | ▶ | $obj->croakError("$class: Encoding '$want_encoding' is not available") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | if ! $encoding; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 15 | return $encoding; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 130 | our ($needBinmode); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 130 | $needBinmode = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | sub setBinModeInput($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2198 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setBinModeInput: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2198 | my $handle = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2198 | ▶ | binmode $handle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | if $needBinmode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | sub setBinModeOutput($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 1054 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setBinModeOutput: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 1054 | my $handle = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1054 | ▶ | binmode $handle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | if $needBinmode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | sub isaFilehandle($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 16669 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isaFilehandle: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 130 | ▶ | use utf8; # Pragma needed to keep Perl 5.6.0 happy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 16669 | ▶ | return (defined $_[0] and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
defined $_[0] && (UNIVERSAL::isa($_[0], 'GLOB') || UNIVERSAL::isa($_[0], 'IO::Handle') || UNIVERSAL::isa(\$_[0], 'GLOB'))
UNIVERSAL::isa($_[0], "GLOB") or UNIVERSAL::isa($_[0], "IO::Handle") or UNIVERSAL::isa(\$_[0], "GLOB")
UNIVERSAL::isa($_[0], "GLOB") or UNIVERSAL::isa($_[0], "IO::Handle")
MC/DC75%3/4
defined $_[0] && (UNIVERSAL::isa($_[0], 'GLOB') || UNIVERSAL::isa($_[0], 'IO::Handle') || UNIVERSAL::isa(\$_[0], 'GLOB'))
defined $_[0]
UNIVERSAL::isa($_[0], "GLOB")
UNIVERSAL::isa($_[0], "IO::Handle")
UNIVERSAL::isa(\$_[0], "GLOB")
Truth table80%4/5
A && B or C or D
A= defined $_[0]B= UNIVERSAL::isa($_[0], "GLOB")C= UNIVERSAL::isa($_[0], "IO::Handle")D= UNIVERSAL::isa(\$_[0], "GLOB")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | (UNIVERSAL::isa($_[0],'GLOB') or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | UNIVERSAL::isa($_[0],'IO::Handle') or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | UNIVERSAL::isa(\$_[0],'GLOB')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | sub isaScalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1048 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isaScalar: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1048 | ▶ | return ( defined($_[0]) and ref($_[0]) eq 'SCALAR' and defined ${ $_[0] } ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
defined $_[0] && ref $_[0] eq 'SCALAR' && defined ${$_[0];}
defined $_[0] and ref $_[0] eq "SCALAR"
MC/DC66%2/3
defined $_[0] && ref $_[0] eq 'SCALAR' && defined ${$_[0];}
defined $_[0]
ref $_[0] eq "SCALAR"
defined ${$_[0];}
Truth table75%3/4
A and B && C
A= defined $_[0]B= ref $_[0] eq "SCALAR"C= defined ${$_[0];}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | sub isaFilename($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1495 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isaFilename: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 1495 | ▶ | return (defined $_[0] and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
defined $_[0] && !ref($_[0]) && UNIVERSAL::isa(\$_[0], 'SCALAR')
defined $_[0] and not ref $_[0]
MC/DC100%3/3
defined $_[0] && !ref($_[0]) && UNIVERSAL::isa(\$_[0], 'SCALAR')
defined $_[0]
not ref $_[0]
UNIVERSAL::isa(\$_[0], 'SCALAR')
Truth table100%4/4
A and not(B) && C
A= defined $_[0]B= not ref $_[0]C= UNIVERSAL::isa(\$_[0], 'SCALAR')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ! ref $_[0] and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | UNIVERSAL::isa(\$_[0], 'SCALAR')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | sub isaFileGlobString | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 1008 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isaFileGlobString: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1008 | ▶ | return defined $_[0] && $_[0] =~ /^<.*>$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $_[0] && $_[0] =~ /^<.*>$/
MC/DC100%2/2
defined $_[0] && $_[0] =~ /^<.*>$/
defined $_[0]
$_[0] =~ /^<.*>$/
Truth table100%3/3
A && B
A= defined $_[0]B= $_[0] =~ /^<.*>$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | sub cleanFileGlobString | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 110 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanFileGlobString: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 110 | my $string = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 110 | $string =~ s/^\s*<\s*(.*)\s*>\s*$/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 110 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 130 | ▶ | use constant WANT_CODE => 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 130 | ▶ | use constant WANT_EXT => 2 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 130 | ▶ | use constant WANT_UNDEF => 4 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | #use constant WANT_HASH => 8 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 130 | ▶ | use constant WANT_HASH => 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | sub whatIsInput($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 9132 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
whatIsInput: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 9132 | my $got = whatIs(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 9132 | ▶ | if (defined $got && $got eq 'filename' && defined $_[0] && $_[0] eq '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
defined $got and $got eq "filename" and defined $_[0] and $_[0] eq "-"
defined $got and $got eq "filename" and defined $_[0]
defined $got and $got eq "filename"
MC/DC75%3/4
defined $got and $got eq "filename" and defined $_[0] and $_[0] eq "-"
defined $got
$got eq "filename"
defined $_[0]
$_[0] eq "-"
Truth table80%4/5
A and B and C and D
A= defined $gotB= $got eq "filename"C= defined $_[0]D= $_[0] eq "-"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | #use IO::File; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 100 | $got = 'handle'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 100 | $_[0] = *STDIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | #$_[0] = IO::File->new("<-"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 9132 | return $got; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | sub whatIsOutput($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 5366 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
whatIsOutput: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 5366 | my $got = whatIs(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 5366 | ▶ | if (defined $got && $got eq 'filename' && defined $_[0] && $_[0] eq '-') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
defined $got and $got eq "filename" and defined $_[0] and $_[0] eq "-"
defined $got and $got eq "filename" and defined $_[0]
defined $got and $got eq "filename"
MC/DC50%2/4
defined $got and $got eq "filename" and defined $_[0] and $_[0] eq "-"
defined $got
$got eq "filename"
defined $_[0]
$_[0] eq "-"
Truth table60%3/5
A and B and C and D
A= defined $gotB= $got eq "filename"C= defined $_[0]D= $_[0] eq "-"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 24 | $got = 'handle'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 24 | $_[0] = *STDOUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | #$_[0] = IO::File->new(">-"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5366 | return $got; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | sub whatIs ($;$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 14498 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
whatIs: called CC=19 SCAR=29.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 14498 | ▶ | return 'handle' if isaFilehandle($_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 12658 | ▶ | my $wantCode = defined $_[1] && $_[1] & WANT_CODE ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $_[1] && $_[1] & 1
MC/DC100%2/2
defined $_[1] && $_[1] & 1
defined $_[1]
$_[1] & 1
Truth table100%3/3
A && B
A= defined $_[1]B= $_[1] & 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 12658 | ▶ | my $extended = defined $_[1] && $_[1] & WANT_EXT ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $_[1] && $_[1] & 2
MC/DC100%2/2
defined $_[1] && $_[1] & 2
defined $_[1]
$_[1] & 2
Truth table100%3/3
A && B
A= defined $_[1]B= $_[1] & 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 12658 | ▶ | my $undef = defined $_[1] && $_[1] & WANT_UNDEF ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $_[1] && $_[1] & 4
MC/DC0%0/2
defined $_[1] && $_[1] & 4
defined $_[1]
$_[1] & 4
Truth table66%2/3
A && B
A= defined $_[1]B= $_[1] & 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 12658 | ▶ | my $hash = defined $_[1] && $_[1] & WANT_HASH ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $_[1] && $_[1] & 0
MC/DC0%0/2
defined $_[1] && $_[1] & 0
defined $_[1]
$_[1] & 0
Truth table66%2/3
A && B
A= defined $_[1]B= $_[1] & 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 12658 | ▶ | return 'undef' if ! defined $_[0] && $undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $_[0] and $undef
MC/DC0%0/2
not defined $_[0] and $undef
not defined $_[0]
$undef
Truth table66%2/3
not(A) and B
A= not defined $_[0]B= $undef
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 12658 | ▶ | if (ref $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 6194 | ▶ | return '' if blessed($_[0]); # is an object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | #return '' if UNIVERSAL::isa($_[0], 'UNIVERSAL'); # is an object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 6134 | ▶ | return 'buffer' if UNIVERSAL::isa($_[0], 'SCALAR'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 334 | ▶ | return 'array' if UNIVERSAL::isa($_[0], 'ARRAY') && $extended ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
UNIVERSAL::isa($_[0], "ARRAY") and $extended
MC/DC100%2/2
UNIVERSAL::isa($_[0], "ARRAY") and $extended
UNIVERSAL::isa($_[0], "ARRAY")
$extended
Truth table100%3/3
A and B
A= UNIVERSAL::isa($_[0], "ARRAY")B= $extended
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 44 | ▶ | return 'hash' if UNIVERSAL::isa($_[0], 'HASH') && $hash ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
UNIVERSAL::isa($_[0], "HASH") and $hash
MC/DC0%0/2
UNIVERSAL::isa($_[0], "HASH") and $hash
UNIVERSAL::isa($_[0], "HASH")
$hash
Truth table33%1/3
A and B
A= UNIVERSAL::isa($_[0], "HASH")B= $hash
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 44 | ▶ | return 'code' if UNIVERSAL::isa($_[0], 'CODE') && $wantCode ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
UNIVERSAL::isa($_[0], "CODE") and $wantCode
MC/DC100%2/2
UNIVERSAL::isa($_[0], "CODE") and $wantCode
UNIVERSAL::isa($_[0], "CODE")
$wantCode
Truth table100%3/3
A and B
A= UNIVERSAL::isa($_[0], "CODE")B= $wantCode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 42 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 6464 | ▶ | return 'fileglob' if $extended && isaFileGlobString($_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$extended and isaFileGlobString($_[0])
MC/DC100%2/2
$extended and isaFileGlobString($_[0])
$extended
isaFileGlobString($_[0])
Truth table100%3/3
A and B
A= $extendedB= isaFileGlobString($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 6269 | return 'filename'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | sub oneTarget | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 3088 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oneTarget: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 3088 | return $_[0] =~ /^(code|handle|buffer|filename)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | sub IO::Compress::Base::Validator::new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 1544 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=27 SCAR=33.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 1544 | my $class = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 1544 | my $Class = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 1544 | my $error_ref = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 1544 | my $reportClass = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 1544 | my %data = (Class => $Class, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | Error => $error_ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | reportClass => $reportClass, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | ) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 1544 | my $obj = bless \%data, $class ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 1544 | local $Carp::CarpLevel = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1544 | my $inType = $data{inType} = whatIsInput($_[0], WANT_EXT|WANT_HASH); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 1544 | my $outType = $data{outType} = whatIsOutput($_[1], WANT_EXT|WANT_HASH); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1544 | my $oneInput = $data{oneInput} = oneTarget($inType); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1544 | my $oneOutput = $data{oneOutput} = oneTarget($outType); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1544 | ▶ | if (! $inType) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 30 | $obj->croakError("$reportClass: illegal input parameter") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | #return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # if ($inType eq 'hash') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # $obj->{Hash} = 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # $obj->{oneInput} = 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # return $obj->validateHash($_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1514 | ▶ | if (! $outType) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 30 | $obj->croakError("$reportClass: illegal output parameter") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | #return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 1484 | ▶ | if ($inType ne 'fileglob' && $outType eq 'fileglob') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$inType ne "fileglob" and $outType eq "fileglob"
MC/DC100%2/2
$inType ne "fileglob" and $outType eq "fileglob"
$inType ne "fileglob"
$outType eq "fileglob"
Truth table100%3/3
A and B
A= $inType ne "fileglob"B= $outType eq "fileglob"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 15 | $obj->croakError("Need input fileglob for outout fileglob"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | # if ($inType ne 'fileglob' && $outType eq 'hash' && $inType ne 'filename' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # $obj->croakError("input must ne filename or fileglob when output is a hash"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1469 | ▶ | if ($inType eq 'fileglob' && $outType eq 'fileglob') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$inType eq "fileglob" and $outType eq "fileglob"
MC/DC100%2/2
$inType eq "fileglob" and $outType eq "fileglob"
$inType eq "fileglob"
$outType eq "fileglob"
Truth table100%3/3
A and B
A= $inType eq "fileglob"B= $outType eq "fileglob"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 35 | $data{GlobMap} = 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 35 | $data{inType} = $data{outType} = 'filename'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 35 | my $mapper = File::GlobMapper->new($_[0], $_[1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 35 | ▶ | if ( ! $mapper ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 15 | return $obj->saveErrorString($File::GlobMapper::Error) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 20 | $data{Pairs} = $mapper->getFileMap(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 20 | return $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1434 | ▶ | $obj->croakError("$reportClass: input and output $inType are identical") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$inType eq $outType and $_[0] eq $_[1] and $_[0] ne "-"
$inType eq $outType and $_[0] eq $_[1]
MC/DC66%2/3
$inType eq $outType and $_[0] eq $_[1] and $_[0] ne "-"
$inType eq $outType
$_[0] eq $_[1]
$_[0] ne "-"
Truth table75%3/4
A and B and C
A= $inType eq $outTypeB= $_[0] eq $_[1]C= $_[0] ne "-"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | if $inType eq $outType && $_[0] eq $_[1] && $_[0] ne '-' ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 1389 | ▶ | if ($inType eq 'fileglob') # && $outType ne 'fileglob' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 110 | my $glob = cleanFileGlobString($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 110 | my @inputs = glob($glob); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 110 | ▶ | if (@inputs == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | # TODO -- legal or die? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | die "globmap matched zero file -- legal or die???" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | elsif (@inputs == 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 35 | ▶ | $obj->validateInputFilenames($inputs[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 35 | $_[0] = $inputs[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 35 | $data{inType} = 'filename' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 35 | $data{oneInput} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 75 | ▶ | $obj->validateInputFilenames(@inputs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 75 | $_[0] = [ @inputs ] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 75 | $data{inType} = 'filenames' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | elsif ($inType eq 'filename') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 342 | ▶ | $obj->validateInputFilenames($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | elsif ($inType eq 'array') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 175 | $data{inType} = 'filenames' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 175 | ▶ | $obj->validateInputArray($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | return $obj->saveErrorString("$reportClass: output buffer is read-only") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 1274 | ▶ | if $outType eq 'buffer' && readonly(${ $_[1] }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$outType eq "buffer" and &readonly(${$_[1];})
MC/DC100%2/2
$outType eq "buffer" and &readonly(${$_[1];})
$outType eq "buffer"
&readonly(${$_[1];})
Truth table100%3/3
A and B
A= $outType eq "buffer"B= &readonly(${$_[1];})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 1259 | ▶ | if ($outType eq 'filename' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 335 | ▶ | $obj->croakError("$reportClass: output filename is undef or null string") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $_[1] or $_[1] eq ""
MC/DC0%0/2
not defined $_[1] or $_[1] eq ""
not defined $_[1]
$_[1] eq ""
Truth table33%1/3
not(A) or B
A= not defined $_[1]B= $_[1] eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | if ! defined $_[1] || $_[1] eq '' ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 335 | ▶ | if (-e $_[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 156 | ▶ | if (-d _ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 15 | return $obj->saveErrorString("output file '$_[1]' is a directory"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1244 | return $obj ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | sub IO::Compress::Base::Validator::saveErrorString | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 280 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
saveErrorString: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 280 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 280 | ${ $self->{Error} } = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 280 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | sub IO::Compress::Base::Validator::croakError | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 200 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
croakError: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 200 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 200 | $self->saveErrorString($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 200 | croak $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | sub IO::Compress::Base::Validator::validateInputFilenames | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 672 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validateInputFilenames: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 672 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 672 | foreach my $filename (@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 822 | ▶ | $self->croakError("$self->{reportClass}: input filename is undef or null string") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $filename or $filename eq ""
MC/DC100%2/2
not defined $filename or $filename eq ""
not defined $filename
$filename eq ""
Truth table100%3/3
not(A) or B
A= not defined $filenameB= $filename eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | if ! defined $filename || $filename eq '' ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 782 | ▶ | next if $filename eq '-'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 782 | ▶ | if (! -e $filename ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 15 | return $self->saveErrorString("input file '$filename' does not exist"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 767 | ▶ | if (-d _ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 15 | return $self->saveErrorString("input file '$filename' is a directory"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # if (! -r _ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | # return $self->saveErrorString("cannot open file '$filename': $!"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 602 | return 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | sub IO::Compress::Base::Validator::validateInputArray | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 175 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validateInputArray: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 175 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 175 | ▶ | if ( @{ $_[0] } == 0 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 5 | return $self->saveErrorString("empty array reference") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 170 | foreach my $element ( @{ $_[0] } ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 260 | my $inType = whatIsInput($element); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 260 | ▶ | if (! $inType) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 20 | $self->croakError("unknown input parameter") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | elsif($inType eq 'filename') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 220 | ▶ | $self->validateInputFilenames($element) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 20 | $self->croakError("not a filename") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 120 | return 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | #sub IO::Compress::Base::Validator::validateHash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | #{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | # my $self = shift ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | # my $href = shift ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # while (my($k, $v) = each %$href) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # my $ktype = whatIsInput($k); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | # my $vtype = whatIsOutput($v, WANT_EXT|WANT_UNDEF) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | # if ($ktype ne 'filename') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | # return $self->saveErrorString("hash key not filename") ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # my %valid = map { $_ => 1 } qw(filename buffer array undef handle) ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # if (! $valid{$vtype}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | # return $self->saveErrorString("hash value not ok") ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # return $self ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | sub createSelfTiedObject | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 6455 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
createSelfTiedObject: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 6455 | ▶ | my $class = shift || (caller)[0] ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
shift() || (caller)[0]
MC/DC0%0/2
shift() || (caller)[0]
shift()
(caller)[0]
Truth table66%2/3
A || B
A= shift()B= (caller)[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 6455 | my $error_ref = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 6455 | ▶ | my $obj = bless Symbol::gensym(), ref($class) || $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 6455 | tie *$obj, $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 6455 | *$obj->{Closed} = 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 6455 | $$error_ref = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 6455 | *$obj->{Error} = $error_ref ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 6455 | my $errno = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 6455 | *$obj->{ErrorNo} = \$errno ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 6455 | return $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | #package Parse::Parameters ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | #require Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | #our ($VERSION, @ISA, @EXPORT); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | #$VERSION = '2.000_08'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | #@ISA = qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 130 | $EXPORT_TAGS{Parse} = [qw( ParseParameters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | Parse_any Parse_unsigned Parse_signed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | Parse_boolean Parse_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | Parse_code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | Parse_writable_scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 130 | push @EXPORT, @{ $EXPORT_TAGS{Parse} } ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 130 | ▶ | use constant Parse_any => 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 130 | ▶ | use constant Parse_unsigned => 0x02; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 130 | ▶ | use constant Parse_signed => 0x04; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 130 | ▶ | use constant Parse_boolean => 0x08; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 130 | ▶ | use constant Parse_string => 0x10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 130 | ▶ | use constant Parse_code => 0x20; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | #use constant Parse_store_ref => 0x100 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | #use constant Parse_multiple => 0x100 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 130 | ▶ | use constant Parse_writable => 0x200 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 130 | ▶ | use constant Parse_writable_scalar => 0x400 | Parse_writable ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 130 | ▶ | use constant OFF_PARSED => 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 130 | ▶ | use constant OFF_TYPE => 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 130 | ▶ | use constant OFF_DEFAULT => 2 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 130 | ▶ | use constant OFF_FIXED => 3 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | #use constant OFF_FIRST_ONLY => 4 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | #use constant OFF_STICKY => 5 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 130 | ▶ | use constant IxError => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 130 | ▶ | use constant IxGot => 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | sub ParseParameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 58 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ParseParameters: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 58 | ▶ | my $level = shift || 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 58 | my $sub = (caller($level + 1))[3] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 58 | local $Carp::CarpLevel = 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 58 | ▶ | return $_[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
@_ == 2 and defined $_[1] and UNIVERSAL::isa($_[1], "IO::Compress::Base::Parameters")
@_ == 2 and defined $_[1]
MC/DC100%3/3
@_ == 2 and defined $_[1] and UNIVERSAL::isa($_[1], "IO::Compress::Base::Parameters")
@_ == 2
defined $_[1]
UNIVERSAL::isa($_[1], "IO::Compress::Base::Parameters")
Truth table100%4/4
A and B and C
A= @_ == 2B= defined $_[1]C= UNIVERSAL::isa($_[1], "IO::Compress::Base::Parameters")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | if @_ == 2 && defined $_[1] && UNIVERSAL::isa($_[1], "IO::Compress::Base::Parameters"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 57 | my $p = IO::Compress::Base::Parameters->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 57 | ▶ | $p->parse(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | or croak "$sub: $p->[IxError]" ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 37 | return $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 130 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 130 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 130 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | sub Init | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Init: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | my $default = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my %got ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | my $obj = IO::Compress::Base::Parameters::new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | ▶ | while (my ($key, $v) = each %$default) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | croak "need 2 params [@$v]" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | if @$v != 2 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my ($type, $value) = @$v ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # my ($first_only, $sticky, $type, $value) = @$v ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | my $sticky = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my $x ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | $obj->_checkType($key, \$value, $type, 0, \$x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | $key = lc $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # if (! $sticky) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | # $x = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | # if $type & Parse_multiple; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | # $got{$key} = [0, $type, $value, $x, $first_only, $sticky] ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $got{$key} = [0, $type, $value, $x] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | # $got{$key}[OFF_PARSED] = 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | return bless \%got, "IO::Compress::Base::Parameters::Defaults" ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | sub IO::Compress::Base::Parameters::new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 5529 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | #my $class = shift ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 5529 | my $obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 5529 | $obj->[IxError] = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 5529 | $obj->[IxGot] = {} ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 5529 | return bless $obj, 'IO::Compress::Base::Parameters' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | sub IO::Compress::Base::Parameters::setError | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 77 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setError: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 77 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 77 | my $error = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 77 | ▶ | my $retval = @_ ? shift : undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 77 | $self->[IxError] = $error ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 77 | return $retval; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | sub IO::Compress::Base::Parameters::getError | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 57 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getError: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 57 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 57 | return $self->[IxError] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | sub IO::Compress::Base::Parameters::parse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 5709 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=16 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 5709 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 5709 | my $default = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 5709 | my $got = $self->[IxGot] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 5709 | my $firstTime = keys %{ $got } == 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 5709 | my (@Bad) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 5709 | my @entered = () ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # Allow the options to be passed as a hash reference or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | # as the complete hash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 5709 | ▶ | if (@_ == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 1217 | @entered = () ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | elsif (@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 20 | my $href = $_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 20 | ▶ | return $self->setError("Expected even number of parameters, got 1") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not defined $href && ref $href or ref $href ne "HASH"
defined $href && ref $href
MC/DC100%3/3
not defined $href && ref $href or ref $href ne "HASH"
defined $href
ref $href
ref $href ne "HASH"
Truth table100%4/4
not(A && B) or C
A= defined $hrefB= ref $hrefC= ref $href ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | if ! defined $href or ! ref $href or ref $href ne "HASH" ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 5 | foreach my $key (keys %$href) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 6 | push @entered, $key ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 6 | push @entered, \$href->{$key} ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 4472 | my $count = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 4472 | ▶ | return $self->setError("Expected even number of parameters, got $count") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | if $count % 2 != 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 4472 | for my $i (0.. $count / 2 - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 12690 | push @entered, $_[2 * $i] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 12690 | push @entered, \$_[2 * $i + 1] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 5694 | foreach my $key (keys %$default) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 80191 | my ($type, $value) = @{ $default->{$key} } ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 80191 | ▶ | if ($firstTime) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 76290 | $got->{$key} = [0, $type, $value, $value] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 3901 | $got->{$key}[OFF_PARSED] = 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 5694 | my %parsed = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 5694 | for my $i (0.. @entered / 2 - 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 12696 | my $key = $entered[2* $i] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 12696 | my $value = $entered[2* $i+1] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | #print "Key [$key] Value [$value]" ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | #print defined $$value ? "[$$value]\n" : "[undef]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 12696 | $key =~ s/^-// ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 12696 | my $canonkey = lc $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 12696 | ▶ | if ($got->{$canonkey}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 12669 | my $type = $got->{$canonkey}[OFF_TYPE] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 12669 | my $parsed = $parsed{$canonkey}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 12669 | ++ $parsed{$canonkey}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 12669 | ▶ | return $self->setError("Muliple instances of '$key' found") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | if $parsed ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 12668 | my $s ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 12668 | ▶ | $self->_checkType($key, $value, $type, 1, \$s) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | or return undef ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 12634 | $value = $$value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 12634 | $got->{$canonkey} = [1, $type, $value, $s] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 27 | { push (@Bad, $key) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 5659 | ▶ | if (@Bad) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 27 | my ($bad) = join(", ", @Bad) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 27 | return $self->setError("unknown key value(s) $bad") ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 5632 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | sub IO::Compress::Base::Parameters::_checkType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 12668 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_checkType: called CC=26 SCAR=32.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 12668 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 12668 | my $key = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 12668 | my $value = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 12668 | my $type = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 12668 | my $validate = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 12668 | my $output = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | #local $Carp::CarpLevel = $level ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | #print "PARSE $type $key $value $validate $sub\n" ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | 12668 | ▶ | if ($type & Parse_writable_scalar) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 25 | ▶ | return $self->setError("Parameter '$key' not writable") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | if readonly $$value ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 24 | ▶ | if (ref $$value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 12 | ▶ | return $self->setError("Parameter '$key' not a scalar reference") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | if ref $$value ne 'SCALAR' ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 1 | $$output = $$value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 12 | ▶ | return $self->setError("Parameter '$key' not a scalar") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | if ref $value ne 'SCALAR' ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 11 | $$output = $value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 12 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 12643 | $value = $$value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 12643 | ▶ | if ($type & Parse_any) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 2505 | $$output = $value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 2505 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | elsif ($type & Parse_unsigned) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 475 | ▶ | return $self->setError("Parameter '$key' must be an unsigned int, got 'undef'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | if ! defined $value ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 471 | ▶ | return $self->setError("Parameter '$key' must be an unsigned int, got '$value'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | if $value !~ /^\d+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 460 | ▶ | $$output = defined $value ? $value : 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 460 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | elsif ($type & Parse_signed) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 99 | ▶ | return $self->setError("Parameter '$key' must be a signed int, got 'undef'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | if ! defined $value ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 98 | ▶ | return $self->setError("Parameter '$key' must be a signed int, got '$value'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | if $value !~ /^-?\d+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 97 | ▶ | $$output = defined $value ? $value : 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 97 | return 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | elsif ($type & Parse_boolean) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 9555 | ▶ | return $self->setError("Parameter '$key' must be an int, got '$value'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value and not $value =~ /^\d*$/
MC/DC50%1/2
defined $value and not $value =~ /^\d*$/
defined $value
not $value =~ /^\d*$/
Truth table66%2/3
A and not(B)
A= defined $valueB= not $value =~ /^\d*$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | if defined $value && $value !~ /^\d*$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 9552 | ▶ | $$output = defined $value && $value != 0 ? 1 : 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value and $value != 0
MC/DC50%1/2
defined $value and $value != 0
defined $value
$value != 0
Truth table66%2/3
A and B
A= defined $valueB= $value != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 9552 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | elsif ($type & Parse_string) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 1 | ▶ | $$output = defined $value ? $value : "" ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | elsif ($type & Parse_code) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 7 | ▶ | return $self->setError("Parameter '$key' must be a code reference, got '$value'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not defined $value or ref $value ne "CODE"
MC/DC50%1/2
not defined $value or ref $value ne "CODE"
not defined $value
ref $value ne "CODE"
Truth table66%2/3
not(A) or B
A= not defined $valueB= ref $value ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | if (! defined $value || ref $value ne 'CODE') ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 6 | ▶ | $$output = defined $value ? $value : "" ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 6 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 1 | $$output = $value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | sub IO::Compress::Base::Parameters::parsed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 12059 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parsed: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 12059 | return $_[0]->[IxGot]{$_[1]}[OFF_PARSED] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | sub IO::Compress::Base::Parameters::getValue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 91193 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getValue: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 91193 | return $_[0]->[IxGot]{$_[1]}[OFF_FIXED] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | sub IO::Compress::Base::Parameters::setValue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 8086 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setValue: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 8086 | $_[0]->[IxGot]{$_[1]}[OFF_PARSED] = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 8086 | $_[0]->[IxGot]{$_[1]}[OFF_DEFAULT] = $_[2] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 8086 | $_[0]->[IxGot]{$_[1]}[OFF_FIXED] = $_[2] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | sub IO::Compress::Base::Parameters::valueRef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valueRef: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | return $_[0]->[IxGot]{$_[1]}[OFF_FIXED] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | sub IO::Compress::Base::Parameters::valueOrDefault | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 2392 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valueOrDefault: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 2392 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 2392 | my $name = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 2392 | my $default = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 2392 | my $value = $self->[IxGot]{$name}[OFF_DEFAULT] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 2392 | ▶ | return $value if defined $value ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 398 | return $default ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | sub IO::Compress::Base::Parameters::wantValue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 1176 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wantValue: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | 1176 | return defined $_[0]->[IxGot]{$_[1]}[OFF_DEFAULT] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | sub IO::Compress::Base::Parameters::clone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 255 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 255 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 255 | my $obj = [] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 255 | my %got ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 255 | my $hash = $self->[IxGot] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 255 | for my $k (keys %{ $hash }) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 5616 | $got{$k} = [ @{ $hash->{$k} } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 255 | $obj->[IxError] = $self->[IxError]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 255 | $obj->[IxGot] = \%got ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 255 | return bless $obj, 'IO::Compress::Base::Parameters' ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | package U64; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 130 | ▶ | use constant MAX32 => 0xFFFFFFFF ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 130 | ▶ | use constant HI_1 => MAX32 + 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 130 | ▶ | use constant LOW => 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 130 | ▶ | use constant HIGH => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 11308 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 11308 | ▶ | return bless [ 0, 0 ], $_[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | if @_ == 1 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 20 | ▶ | return bless [ $_[1], 0 ], $_[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | if @_ == 2 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 17 | ▶ | return bless [ $_[2], $_[1] ], $_[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | if @_ == 3 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | sub newUnpack_V64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 118 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
newUnpack_V64: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 118 | my ($low, $hi) = unpack "V V", $_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 118 | bless [ $low, $hi ], "U64"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | sub newUnpack_V32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 3952 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
newUnpack_V32: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 3952 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 3952 | my $low = unpack "V", $string ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 3952 | bless [ $low, 0 ], "U64"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | sub reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 3919 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 3919 | $_[0]->[HIGH] = $_[0]->[LOW] = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | sub clone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 558 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 558 | bless [ @{$_[0]} ], ref $_[0] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | sub getHigh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 23 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getHigh: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 23 | return $_[0]->[HIGH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | sub getLow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 23 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getLow: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 23 | return $_[0]->[LOW]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | sub get32bit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 1475 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get32bit: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 1475 | return $_[0]->[LOW]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | sub get64bit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 2697 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get64bit: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | # Not using << here because the result will still be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | # a 32-bit value on systems where int size is 32-bits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 2697 | return $_[0]->[HIGH] * HI_1 + $_[0]->[LOW]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | sub add | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 16071 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 16071 | my $value = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 16071 | ▶ | if (ref $value eq 'U64') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 412 | $_[0]->[HIGH] += $value->[HIGH] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 412 | $value = $value->[LOW]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | elsif ($value > MAX32) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | $_[0]->[HIGH] += int($value / HI_1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $value = $value % HI_1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 16071 | my $available = MAX32 - $_[0]->[LOW] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 16071 | ▶ | if ($value > $available) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 2 | ++ $_[0]->[HIGH] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 2 | $_[0]->[LOW] = $value - $available - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 16069 | $_[0]->[LOW] += $value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | sub add32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 843 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add32: called CC=3 SCAR=13.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 843 | my $value = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 843 | ▶ | if ($value > MAX32) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | $_[0]->[HIGH] += int($value / HI_1) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | $value = $value % HI_1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 843 | my $available = MAX32 - $_[0]->[LOW] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 843 | ▶ | if ($value > $available) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | ++ $_[0]->[HIGH] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | $_[0]->[LOW] = $value - $available - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | 843 | $_[0]->[LOW] += $value ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | sub subtract | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subtract: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 4 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 4 | ▶ | if (ref $value eq 'U64') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 2 | ▶ | if ($value->[HIGH]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 2 | ▶ | die "bad" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->[1] == 0 or $value->[1] > $self->[1]
MC/DC0%0/2
$self->[1] == 0 or $value->[1] > $self->[1]
$self->[1] == 0
$value->[1] > $self->[1]
Truth table33%1/3
A or B
A= $self->[1] == 0B= $value->[1] > $self->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | if $self->[HIGH] == 0 || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | $value->[HIGH] > $self->[HIGH] ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 2 | $self->[HIGH] -= $value->[HIGH] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 2 | $value = $value->[LOW] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 4 | ▶ | if ($value > $self->[LOW]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 3 | -- $self->[HIGH] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | 3 | $self->[LOW] = MAX32 - $value + $self->[LOW] + 1 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 1 | $self->[LOW] -= $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | sub equal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 1030 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equal: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 1030 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 1030 | my $other = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 1030 | ▶ | return $self->[LOW] == $other->[LOW] && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->[0] == $other->[0] && $self->[1] == $other->[1]
MC/DC50%1/2
$self->[0] == $other->[0] && $self->[1] == $other->[1]
$self->[0] == $other->[0]
$self->[1] == $other->[1]
Truth table66%2/3
A && B
A= $self->[0] == $other->[0]B= $self->[1] == $other->[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | $self->[HIGH] == $other->[HIGH] ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | sub isZero | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isZero: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | return $self->[LOW] == 0 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->[0] == 0 && $self->[1] == 0
MC/DC0%0/2
$self->[0] == 0 && $self->[1] == 0
$self->[0] == 0
$self->[1] == 0
Truth table0%0/3
A && B
A= $self->[0] == 0B= $self->[1] == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | $self->[HIGH] == 0 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | sub gt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gt: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 1 | my $other = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 1 | return $self->cmp($other) > 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | sub cmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cmp: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 3 | my $other = shift ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 3 | ▶ | if ($self->[LOW] == $other->[LOW]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | return $self->[HIGH] - $other->[HIGH] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 3 | return $self->[LOW] - $other->[LOW] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | sub is64bit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | 1189 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is64bit: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | 1189 | return $_[0]->[HIGH] > 0 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | sub isAlmost64bit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 822 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isAlmost64bit: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 822 | ▶ | return $_[0]->[HIGH] > 0 || $_[0]->[LOW] == MAX32 ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_[0][1] > 0 || $_[0][0] == 4294967295
MC/DC0%0/2
$_[0][1] > 0 || $_[0][0] == 4294967295
$_[0][1] > 0
$_[0][0] == 4294967295
Truth table33%1/3
A || B
A= $_[0][1] > 0B= $_[0][0] == 4294967295
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | sub getPacked_V64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 916 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPacked_V64: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 916 | return pack "V V", @{ $_[0] } ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | sub getPacked_V32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 2003 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getPacked_V32: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 2003 | return pack "V", $_[0]->[LOW] ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | sub pack_V64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 84 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pack_V64: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 84 | return pack "V V", $_[0], 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | sub full32 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 32 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
full32: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 32 | return $_[0] == MAX32 ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | sub Value_VV64 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Value_VV64: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | my $buffer = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | my ($lo, $hi) = unpack ("V V" , $buffer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 130 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | return $hi * HI_1 + $lo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | package IO::Compress::Base::Common; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 130 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||