« /usr/local/lib/perl5/5.44.0/version.pm
↑ Summary
/usr/local/lib/perl5/5.44.0/x86_64-linux/IO/Socket/UNIX.pm »
| 1 | package Digest::SHA; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 7 | require 5.003000; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use vars qw($VERSION @ISA @EXPORT_OK $errmsg); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use Fcntl qw(O_RDONLY O_RDWR); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Cwd qw(getcwd); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use integer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 7 | $VERSION = '6.04'; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 7 | require Exporter; | |||||||||||||||||||||||||||
| 15 | 7 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 16 | 7 | @EXPORT_OK = qw( | |||||||||||||||||||||||||||
| 17 | $errmsg | ||||||||||||||||||||||||||||
| 18 | hmac_sha1 hmac_sha1_base64 hmac_sha1_hex | ||||||||||||||||||||||||||||
| 19 | hmac_sha224 hmac_sha224_base64 hmac_sha224_hex | ||||||||||||||||||||||||||||
| 20 | hmac_sha256 hmac_sha256_base64 hmac_sha256_hex | ||||||||||||||||||||||||||||
| 21 | hmac_sha384 hmac_sha384_base64 hmac_sha384_hex | ||||||||||||||||||||||||||||
| 22 | hmac_sha512 hmac_sha512_base64 hmac_sha512_hex | ||||||||||||||||||||||||||||
| 23 | hmac_sha512224 hmac_sha512224_base64 hmac_sha512224_hex | ||||||||||||||||||||||||||||
| 24 | hmac_sha512256 hmac_sha512256_base64 hmac_sha512256_hex | ||||||||||||||||||||||||||||
| 25 | sha1 sha1_base64 sha1_hex | ||||||||||||||||||||||||||||
| 26 | sha224 sha224_base64 sha224_hex | ||||||||||||||||||||||||||||
| 27 | sha256 sha256_base64 sha256_hex | ||||||||||||||||||||||||||||
| 28 | sha384 sha384_base64 sha384_hex | ||||||||||||||||||||||||||||
| 29 | sha512 sha512_base64 sha512_hex | ||||||||||||||||||||||||||||
| 30 | sha512224 sha512224_base64 sha512224_hex | ||||||||||||||||||||||||||||
| 31 | sha512256 sha512256_base64 sha512256_hex); | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # Inherit from Digest::base if possible | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 7 | eval { | |||||||||||||||||||||||||||
| 36 | 7 | require Digest::base; | |||||||||||||||||||||||||||
| 37 | 7 | push(@ISA, 'Digest::base'); | |||||||||||||||||||||||||||
| 38 | }; | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # The following routines aren't time-critical, so they can be left in Perl | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 0 | my($class, $alg) = @_; | |||||||||||||||||||||||||||
| 44 | 0 | ▶ | $alg =~ s/\D+//g if defined $alg; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | if (ref($class)) { # instance method | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if (!defined($alg) || ($alg == $class->algorithm)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $alg or $alg == $class->algorithm
MC/DC0%0/2
not defined $alg or $alg == $class->algorithm
not defined $alg
$alg == $class->algorithm
Truth table0%0/3
not(A) or B
A= not defined $algB= $alg == $class->algorithm
| |||||||||||||||||||||||||||||
| 47 | 0 | sharewind($class); | |||||||||||||||||||||||||||
| 48 | 0 | return($class); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | return shainit($class, $alg) ? $class : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $alg = 1 unless defined $alg; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 0 | return $class->newSHA($alg); | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 7 | ▶ | BEGIN { *reset = \&new } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub add_bits { | ||||||||||||||||||||||||||
|
Subroutine
add_bits: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 59 | 0 | my($self, $data, $nbits) = @_; | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | unless (defined $nbits) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 0 | $nbits = length($data); | |||||||||||||||||||||||||||
| 62 | 0 | $data = pack("B*", $data); | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | 0 | ▶ | $nbits = length($data) * 8 if $nbits > length($data) * 8; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 0 | shawrite($data, $nbits, $self); | |||||||||||||||||||||||||||
| 66 | 0 | return($self); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub _bail { | ||||||||||||||||||||||||||
|
Subroutine
_bail: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 70 | 0 | my $msg = shift; | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | $errmsg = $!; | |||||||||||||||||||||||||||
| 73 | 0 | $msg .= ": $!"; | |||||||||||||||||||||||||||
| 74 | 0 | require Carp; | |||||||||||||||||||||||||||
| 75 | 0 | Carp::croak($msg); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||
| 79 | 7 | my $_can_T_filehandle; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub _istext { | ||||||||||||||||||||||||||
|
Subroutine
_istext: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 82 | 0 | local *FH = shift; | |||||||||||||||||||||||||||
| 83 | 0 | my $file = shift; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if (! defined $_can_T_filehandle) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 0 | local $^W = 0; | |||||||||||||||||||||||||||
| 87 | 0 | my $istext = eval { -T FH }; | |||||||||||||||||||||||||||
| 88 | 0 | ▶ | $_can_T_filehandle = $@ ? 0 : 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | return $_can_T_filehandle ? $istext : -T $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | 0 | ▶ | return $_can_T_filehandle ? -T FH : -T $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 7 | ▶ | sub _addfile { | ||||||||||||||||||||||||||
|
Subroutine
_addfile: not called CC=3 SCAR=23.0
| |||||||||||||||||||||||||||||
| 96 | 0 | my ($self, $handle) = @_; | |||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | my $n; | |||||||||||||||||||||||||||
| 99 | 0 | my $buf = ""; | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | while (($n = read($handle, $buf, 4096))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | $self->add($buf); | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | 0 | ▶ | _bail("Read failed") unless defined $n; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | $self; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub addfile { | ||||||||||||||||||||||||||
|
Subroutine
addfile: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||
| 110 | 0 | my ($self, $file, $mode) = @_; | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | return(_addfile($self, $file)) unless ref(\$file) eq 'SCALAR'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | $mode = defined($mode) ? $mode : ""; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | my ($binary, $UNIVERSAL, $BITS) = | ||||||||||||||||||||||||||||
| 116 | 0 | map { $_ eq $mode } ("b", "U", "0"); | |||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | ## Always interpret "-" to mean STDIN; otherwise use | ||||||||||||||||||||||||||||
| 119 | ## sysopen to handle full range of POSIX file names. | ||||||||||||||||||||||||||||
| 120 | ## If $file is a directory, force an EISDIR error | ||||||||||||||||||||||||||||
| 121 | ## by attempting to open with mode O_RDWR | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 0 | local *FH; | |||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ($file eq '-') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if (-d STDIN) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sysopen(FH, getcwd(), O_RDWR) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | or _bail('Open failed'); | ||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | 0 | ▶ | open(FH, '< -') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | or _bail('Open failed'); | ||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | else { | ||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sysopen(FH, $file, -d $file ? O_RDWR : O_RDONLY) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 134 | or _bail('Open failed'); | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if ($BITS) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | 0 | my ($n, $buf) = (0, ""); | |||||||||||||||||||||||||||
| 139 | 0 | ▶ | while (($n = read(FH, $buf, 4096))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 0 | $buf =~ tr/01//cd; | |||||||||||||||||||||||||||
| 141 | 0 | $self->add_bits($buf); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | 0 | ▶ | _bail("Read failed") unless defined $n; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | close(FH); | |||||||||||||||||||||||||||
| 145 | 0 | return($self); | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | binmode(FH) if $binary || $UNIVERSAL; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$binary or $UNIVERSAL
MC/DC0%0/2
$binary or $UNIVERSAL
$binary
$UNIVERSAL
Truth table0%0/3
A or B
A= $binaryB= $UNIVERSAL
| |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if ($UNIVERSAL && _istext(*FH, $file)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$UNIVERSAL and _istext(*FH, $file)
MC/DC0%0/2
$UNIVERSAL and _istext(*FH, $file)
$UNIVERSAL
_istext(*FH, $file)
Truth table0%0/3
A and B
A= $UNIVERSALB= _istext(*FH, $file)
| |||||||||||||||||||||||||||||
| 150 | 0 | $self->_addfileuniv(*FH); | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | 0 | else { $self->_addfilebin(*FH) } | |||||||||||||||||||||||||||
| 153 | 0 | close(FH); | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | $self; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | sub getstate { | ||||||||||||||||||||||||||
|
Subroutine
getstate: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 159 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 0 | ▶ | my $alg = $self->algorithm or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $state = $self->_getstate or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 163 | 0 | ▶ | my $nD = $alg <= 256 ? 8 : 16; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $nH = $alg <= 256 ? 32 : 64; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | ▶ | my $nB = $alg <= 256 ? 64 : 128; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | 0 | my($H, $block, $blockcnt, $lenhh, $lenhl, $lenlh, $lenll) = | |||||||||||||||||||||||||||
| 167 | $state =~ /^(.{$nH})(.{$nB})(.{4})(.{4})(.{4})(.{4})(.{4})$/s; | ||||||||||||||||||||||||||||
| 168 | 0 | for ($alg, $H, $block, $blockcnt, $lenhh, $lenhl, $lenlh, $lenll) { | |||||||||||||||||||||||||||
| 169 | 0 | ▶ | return unless defined $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | my @s = (); | |||||||||||||||||||||||||||
| 173 | 0 | push(@s, "alg:" . $alg); | |||||||||||||||||||||||||||
| 174 | 0 | push(@s, "H:" . join(":", unpack("H*", $H) =~ /.{$nD}/g)); | |||||||||||||||||||||||||||
| 175 | 0 | push(@s, "block:" . join(":", unpack("H*", $block) =~ /.{2}/g)); | |||||||||||||||||||||||||||
| 176 | 0 | push(@s, "blockcnt:" . unpack("N", $blockcnt)); | |||||||||||||||||||||||||||
| 177 | 0 | push(@s, "lenhh:" . unpack("N", $lenhh)); | |||||||||||||||||||||||||||
| 178 | 0 | push(@s, "lenhl:" . unpack("N", $lenhl)); | |||||||||||||||||||||||||||
| 179 | 0 | push(@s, "lenlh:" . unpack("N", $lenlh)); | |||||||||||||||||||||||||||
| 180 | 0 | push(@s, "lenll:" . unpack("N", $lenll)); | |||||||||||||||||||||||||||
| 181 | 0 | join("\n", @s) . "\n"; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub putstate { | ||||||||||||||||||||||||||
|
Subroutine
putstate: not called CC=13 SCAR=50.0
Pod
documented
| |||||||||||||||||||||||||||||
| 185 | 0 | my($class, $state) = @_; | |||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 0 | my %s = (); | |||||||||||||||||||||||||||
| 188 | 0 | for (split(/\n/, $state)) { | |||||||||||||||||||||||||||
| 189 | 0 | s/^\s+//; | |||||||||||||||||||||||||||
| 190 | 0 | s/\s+$//; | |||||||||||||||||||||||||||
| 191 | 0 | ▶ | next if (/^(#|$)/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 0 | my @f = split(/[:\s]+/); | |||||||||||||||||||||||||||
| 193 | 0 | my $tag = shift(@f); | |||||||||||||||||||||||||||
| 194 | 0 | $s{$tag} = join('', @f); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | # H and block may contain arbitrary values, but check everything else | ||||||||||||||||||||||||||||
| 198 | 0 | ▶ | grep { $_ == $s{'alg'} } (1,224,256,384,512,512224,512256) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | length($s{'H'}) == ($s{'alg'} <= 256 ? 64 : 128) or return; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 200 | 0 | ▶ | length($s{'block'}) == ($s{'alg'} <= 256 ? 128 : 256) or return; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 201 | { | ||||||||||||||||||||||||||||
| 202 | 0 | ▶ | no integer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 203 | 0 | for (qw(blockcnt lenhh lenhl lenlh lenll)) { | |||||||||||||||||||||||||||
| 204 | 0 | ▶ | 0 <= $s{$_} or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 0 | ▶ | $s{$_} <= 4294967295 or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 0 | ▶ | $s{'blockcnt'} < ($s{'alg'} <= 256 ? 512 : 1024) or return; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | my $packed_state = ( | ||||||||||||||||||||||||||||
| 211 | pack("H*", $s{'H'}) . | ||||||||||||||||||||||||||||
| 212 | pack("H*", $s{'block'}) . | ||||||||||||||||||||||||||||
| 213 | pack("N", $s{'blockcnt'}) . | ||||||||||||||||||||||||||||
| 214 | pack("N", $s{'lenhh'}) . | ||||||||||||||||||||||||||||
| 215 | pack("N", $s{'lenhl'}) . | ||||||||||||||||||||||||||||
| 216 | pack("N", $s{'lenlh'}) . | ||||||||||||||||||||||||||||
| 217 | 0 | pack("N", $s{'lenll'}) | |||||||||||||||||||||||||||
| 218 | ); | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | return $class->new($s{'alg'})->_putstate($packed_state); | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | ▶ | sub dump { | ||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 224 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 225 | 0 | my $file = shift; | |||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | my $state = $self->getstate or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $file = "-" if (!defined($file) || $file eq ""); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $file or $file eq ""
MC/DC0%0/2
not defined $file or $file eq ""
not defined $file
$file eq ""
Truth table0%0/3
not(A) or B
A= not defined $fileB= $file eq ""
| |||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | local *FH; | |||||||||||||||||||||||||||
| 231 | 0 | ▶ | open(FH, "> $file") or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 0 | print FH $state; | |||||||||||||||||||||||||||
| 233 | 0 | close(FH); | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 0 | return($self); | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | ▶ | sub load { | ||||||||||||||||||||||||||
|
Subroutine
load: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 239 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 240 | 0 | my $file = shift; | |||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 0 | ▶ | $file = "-" if (!defined($file) || $file eq ""); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $file or $file eq ""
MC/DC0%0/2
not defined $file or $file eq ""
not defined $file
$file eq ""
Truth table0%0/3
not(A) or B
A= not defined $fileB= $file eq ""
| |||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 0 | local *FH; | |||||||||||||||||||||||||||
| 245 | 0 | ▶ | open(FH, "< $file") or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 0 | my $str = join('', <FH>); | |||||||||||||||||||||||||||
| 247 | 0 | close(FH); | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 0 | $class->putstate($str); | |||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | eval { | ||||||||||||||||||||||||||||
| 253 | 7 | require XSLoader; | |||||||||||||||||||||||||||
| 254 | 7 | XSLoader::load('Digest::SHA', $VERSION); | |||||||||||||||||||||||||||
| 255 | 7 | 1; | |||||||||||||||||||||||||||
| 256 | 7 | ▶ | } or do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 0 | require DynaLoader; | |||||||||||||||||||||||||||
| 258 | 0 | push @ISA, 'DynaLoader'; | |||||||||||||||||||||||||||
| 259 | 0 | Digest::SHA->bootstrap($VERSION); | |||||||||||||||||||||||||||
| 260 | }; | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 7 | 1; | |||||||||||||||||||||||||||
| 263 | __END__ | ||||||||||||||||||||||||||||