| 1 | package Bifcode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 7 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use boolean (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use Exporter::Tidy all => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | qw( encode_bifcode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | decode_bifcode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | force_bifcode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | diff_bifcode) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # ABSTRACT: Serialisation similar to Bencode + undef/UTF8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | our $VERSION = 'v2.0.16'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | our $max_depth; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | our @CARP_NOT = (__PACKAGE__); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 78 | ▶ | sub _croak { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_croak: called CC=6 SCAR=20.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 78 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 78 | ▶ | my $type = shift // Carp::croak('usage: _croak($TYPE, [$msg])'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() // Carp::croak("usage: _croak(\$TYPE, [\$msg])")
MC/DC0%0/1
shift() // Carp::croak("usage: _croak(\$TYPE, [\$msg])")
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 78 | my %messages = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | Decode => 'garbage at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | DecodeBifcodeTerm => 'missing BIFCODE terminator at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | DecodeBytes => 'malformed BYTES length at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | DecodeBytesTrunc => 'unexpected BYTES end of data at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | DecodeBytesTerm => 'missing BYTES termination at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | DecodeDepth => 'nesting depth exceeded at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | DecodeTrunc => 'unexpected end of data at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | DecodeReal => 'malformed REAL data at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | DecodeRealTrunc => 'unexpected REAL end of data at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | DecodeInteger => 'malformed INTEGER data at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | DecodeIntegerTrunc => 'unexpected INTEGER end of data at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | DecodeTrailing => 'trailing garbage at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | DecodeUTF8 => 'malformed UTF8 string length at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | DecodeUTF8Trunc => 'unexpected UTF8 end of data at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | DecodeUTF8Term => 'missing UTF8 termination at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | DecodeUsage => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | DiffUsage => 'usage: diff_bifcode($b1, $b2, [$diff_args])', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | EncodeBytesUndef => 'Bifcode::BYTES ref is undefined', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | EncodeReal => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | EncodeRealUndef => 'Bifcode::REAL ref is undefined', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | EncodeInteger => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | EncodeIntegerUndef => 'Bifcode::INTEGER ref is undefined', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | DecodeKeyType => 'dict key is not BYTES or UTF8 at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | DecodeKeyDuplicate => 'duplicate dict key at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | DecodeKeyOrder => 'dict key not in sort order at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | DecodeKeyValue => 'dict key is missing value at', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | EncodeUTF8Undef => 'Bifcode::UTF8 ref is undefined', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | EncodeUnhandled => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | EncodeUsage => 'usage: encode_bifcode($arg)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ForceUsage => 'ref and type must be defined', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 78 | my $err = 'Bifcode::Error::' . $type; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 78 | ▶ | my $msg = shift // $messages{$type} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition60%3/5
(shift() // $messages{$type}) // Carp::croak("Bifcode::_croak($type) has no message ")
shift() // $messages{$type}
MC/DC0%0/2
(shift() // $messages{$type}) // Carp::croak("Bifcode::_croak($type) has no message ")
shift()
$messages{$type}
Truth table66%2/3
A // B
A= shift()B= $messages{$type}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | // Carp::croak("Bifcode::_croak($type) has no message "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 78 | my $short = Carp::shortmess(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 78 | ▶ | $msg =~ s! at$!' at input byte '. ( pos() // 0 )!e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
pos $_ // 0
MC/DC100%1/1
pos $_ // 0
pos $_
Truth table100%2/2
A
A= pos $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | eval qq[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
__ANON__: called CC=1 SCAR=1.9
Subroutine
__ANON__: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
BEGIN: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
Subroutine
__ANON__: not called CC=1 SCAR=1.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | package $err; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | bool => sub { 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | '""' => sub { \${ \$_[0] } . ' (' . ( ref \$_[0] ) . ')$short' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | fallback => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 78 | ▶ | die $@ if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 78 | die bless \$msg, $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 4 | my $chunk = qr/ \G (?| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | (~,) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | | (f,) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | | (t,) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | | (N,) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | | (-,) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | | (\+,) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | | (B|b|u) (?: ( 0 | [1-9] [0-9]* ) \. )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | | (i) (?: ( 0 | -? [1-9] [0-9]* ) , )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | | (r) (?: ( 0 | -? [1-9] [0-9]* ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | \. ( 0 | [0-9]* [1-9] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | e ( (?: 0 | -? [1-9] ) [0-9]* ) , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | | (\[) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | | (\{) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | ) /x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 35 | ▶ | sub _decode_bifcode_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode_bifcode_key: called CC=11 SCAR=25.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 34 | ▶ | unless (m/ \G (b|u) (?: ( 0 | [1-9] [0-9]* ) \. )? /gcx) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 5 | ▶ | _croak m/ \G \z /xgc ? 'DecodeTrunc' : 'DecodeKeyType'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 30 | ▶ | if ( $1 eq 'b' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | ▶ | my $len = $2 // _croak 'DecodeBytes'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$2 // _croak("DecodeBytes")
MC/DC0%0/2
$2 // _croak("DecodeBytes")
$2
_croak("DecodeBytes")
Truth table33%1/3
A // B
A= $2B= _croak("DecodeBytes")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | ▶ | _croak 'DecodeBytesTrunc' if $len > length() - pos(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2 | my $data = substr $_, pos(), $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | pos() = pos() + $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | ▶ | _croak 'DecodeBytesTerm' unless m/ \G : /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2 | $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | elsif ( $1 eq 'u' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 29 | ▶ | my $len = $2 // _croak 'DecodeUTF8'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$2 // _croak("DecodeUTF8")
MC/DC0%0/2
$2 // _croak("DecodeUTF8")
$2
_croak("DecodeUTF8")
Truth table33%1/3
A // B
A= $2B= _croak("DecodeUTF8")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 29 | ▶ | _croak 'DecodeUTF8Trunc' if $len > length() - pos(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 29 | utf8::decode( my $str = substr $_, pos(), $len ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 29 | pos() = pos() + $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 29 | ▶ | _croak 'DecodeUTF8Term' unless m/ \G : /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 29 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 158 | ▶ | sub _decode_bifcode_chunk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_decode_bifcode_chunk: called CC=44 SCAR=38.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 158 | ▶ | local $max_depth = $max_depth - 1 if defined $max_depth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 158 | ▶ | unless (m/$chunk/gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 9 | ▶ | _croak m/ \G \z /xgc ? 'DecodeTrunc' : 'Decode'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 150 | ▶ | if ( $1 eq '~,' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 13 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 9 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | elsif ( $1 eq 'f,' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 4 | boolean::false; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | elsif ( $1 eq 't,' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | boolean::true; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | elsif ( $1 eq 'N,' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 2 | require Math::BigInt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 2 | Math::BigInt->bnan; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | elsif ( $1 eq '-,' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | require Math::BigInt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 2 | Math::BigInt->binf('-'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | elsif ( $1 eq '+,' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 2 | require Math::BigInt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 2 | Math::BigInt->binf('+'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | elsif ( $1 eq 'b' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 7 | ▶ | my $len = $2 // _croak 'DecodeBytes'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$2 // _croak("DecodeBytes")
MC/DC0%0/2
$2 // _croak("DecodeBytes")
$2
_croak("DecodeBytes")
Truth table33%1/3
A // B
A= $2B= _croak("DecodeBytes")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 5 | ▶ | _croak 'DecodeBytesTrunc' if $len > length() - pos(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 4 | my $data = substr $_, pos(), $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 4 | pos() = pos() + $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 4 | ▶ | _croak 'DecodeBytesTerm' unless m/ \G , /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 3 | $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | elsif ( $1 eq 'u' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 41 | ▶ | my $len = $2 // _croak 'DecodeUTF8'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$2 // _croak("DecodeUTF8")
MC/DC0%0/2
$2 // _croak("DecodeUTF8")
$2
_croak("DecodeUTF8")
Truth table33%1/3
A // B
A= $2B= _croak("DecodeUTF8")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 36 | ▶ | _croak 'DecodeUTF8Trunc' if $len > length() - pos(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 34 | utf8::decode( my $str = substr $_, pos(), $len ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 34 | pos() = pos() + $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 34 | ▶ | _croak 'DecodeUTF8Term' unless m/ \G , /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 32 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | elsif ( $1 eq 'i' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 21 | ▶ | if ( not defined $2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 9 | ▶ | _croak 'DecodeIntegerTrunc' if m/ \G \z /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 8 | _croak 'DecodeInteger'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 13 | 0 + $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | elsif ( $1 eq 'r' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 12 | ▶ | if ( !defined $2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 9 | ▶ | _croak 'DecodeRealTrunc' if m/ \G \z /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 8 | _croak 'DecodeReal'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 4 | ▶ | _croak 'DecodeReal' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$2 eq 0 and $3 eq 0 and $4 ne 0
$2 eq 0 and $3 eq 0
MC/DC66%2/3
$2 eq 0 and $3 eq 0 and $4 ne 0
$2 eq 0
$3 eq 0
$4 ne 0
Truth table75%3/4
A and B and C
A= $2 eq 0B= $3 eq 0C= $4 ne 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | if $2 eq '0' # mantissa 0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | and $3 eq '0' # mantissa 0.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | and $4 ne '0'; # sign or exponent 0.0e0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 3 | 0.0 + ( $2 . '.' . $3 . 'e' . $4 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | elsif ( $1 eq '[' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 27 | ▶ | _croak 'DecodeDepth' if defined $max_depth and $max_depth < 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $Bifcode::max_depth and $Bifcode::max_depth < 0
MC/DC100%2/2
defined $Bifcode::max_depth and $Bifcode::max_depth < 0
defined $Bifcode::max_depth
$Bifcode::max_depth < 0
Truth table100%3/3
A and B
A= defined $Bifcode::max_depthB= $Bifcode::max_depth < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 23 | my @list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 23 | ▶ | until (m/ \G \] /xgc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 36 | push @list, _decode_bifcode_chunk(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 17 | \@list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | elsif ( $1 eq '{' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 30 | ▶ | _croak 'DecodeDepth' if defined $max_depth and $max_depth < 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $Bifcode::max_depth and $Bifcode::max_depth < 0
MC/DC100%2/2
defined $Bifcode::max_depth and $Bifcode::max_depth < 0
defined $Bifcode::max_depth
$Bifcode::max_depth < 0
Truth table100%3/3
A and B
A= defined $Bifcode::max_depthB= $Bifcode::max_depth < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 27 | my $last_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | my %hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 27 | ▶ | until (m/ \G \} /xgc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 36 | ▶ | _croak 'DecodeTrunc' if m/ \G \z /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 34 | my $key = _decode_bifcode_key(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 30 | ▶ | _croak 'DecodeKeyDuplicate' if exists $hash{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 29 | ▶ | _croak 'DecodeKeyOrder' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $last_key and $key lt $last_key
MC/DC100%2/2
defined $last_key and $key lt $last_key
defined $last_key
$key lt $last_key
Truth table100%3/3
A and B
A= defined $last_keyB= $key lt $last_key
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | if defined $last_key and $key lt $last_key; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 28 | ▶ | _croak 'DecodeKeyValue' if m/ \G \} /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 27 | $last_key = $key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 27 | $hash{$key} = _decode_bifcode_chunk(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 14 | \%hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | elsif ( $1 eq 'B' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 1 | ▶ | my $len = $2 // _croak 'DecodeBifcode'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$2 // _croak("DecodeBifcode")
MC/DC0%0/2
$2 // _croak("DecodeBifcode")
$2
_croak("DecodeBifcode")
Truth table0%0/3
A // B
A= $2B= _croak("DecodeBifcode")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | ▶ | _croak 'DecodeBifcodeTrunc' if $len > length() - pos(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | my $res = _decode_bifcode_chunk(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | _croak 'DecodeBifcodeTerm' unless m/ \G , /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 101 | ▶ | sub decode_bifcode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
decode_bifcode: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 101 | local $_ = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 101 | local $max_depth = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 101 | ▶ | _croak 'DecodeUsage', 'decode_bifcode: too many arguments' if @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 100 | ▶ | _croak 'DecodeUsage', 'decode_bifcode: input undefined' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | unless defined $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 98 | ▶ | _croak 'DecodeUsage', 'decode_bifcode: only accepts bytes' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | if utf8::is_utf8($_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 97 | my $deserialised_data = _decode_bifcode_chunk(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 43 | ▶ | _croak 'DecodeTrailing', " For: $_" if $_ !~ m/ \G \z /xgc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 39 | return $deserialised_data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 4 | my $number_qr = qr/\A ( 0 | -? [1-9] [0-9]* ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | ( \. ( [0-9]+? ) 0* )? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | ( e ( -? [0-9]+ ) )? \z/xi; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 90 | ▶ | sub _encode_bifcode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_encode_bifcode: called CC=34 SCAR=35.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 90 | ▶ | if ( !defined $_ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 12 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 5 | '~' . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | elsif ( ( my $ref = ref $_ ) eq '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 49 | ▶ | if ( $_ =~ $number_qr ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 37 | ▶ | if ( defined $3 or defined $5 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $3 or defined $5
MC/DC100%2/2
defined $3 or defined $5
defined $3
defined $5
Truth table100%3/3
A or B
A= defined $3B= defined $5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | # normalize to BIFCODE_REAL standards | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 27 | ▶ | my $x = 'r' . ( 0 + $1 ) # remove leading zeros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$3 // 0
$5 // 0
MC/DC100%1/1
$3 // 0
$3
MC/DC100%1/1
$5 // 0
$5
Truth table100%2/2
A
A= $3
Truth table100%2/2
A
A= $5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | . '.' . ( $3 // 0 ) . 'e' . ( 0 + ( $5 // 0 ) ) . ','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 27 | $x =~ s/ ([1-9]) (0+ e)/.${1}e/x; # remove trailing zeros | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 27 | $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 11 | 'i' . $_ . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | elsif ( utf8::is_utf8($_) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 4 | utf8::encode( my $str = $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 4 | 'u' . length($str) . '.' . $str . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | elsif ( $_ =~ m/^[\x{20}-\x{7E}]*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 10 | 'u' . length($_) . '.' . $_ . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | 'b' . length($_) . '.' . $_ . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | elsif ( $ref eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 6 | '[' . join( '', map _encode_bifcode($_), @$_ ) . ']'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | elsif ( $ref eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | '{' . join( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 8 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 8 | my $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 8 | my @k = sort keys %$_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 15 | $k = shift @k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 15 | ▶ | if ( $k =~ m/^[\x{20}-\x{7E}]*$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 14 | ( 'u' . length($k) . '.' . $k . ':', $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | elsif ( utf8::is_utf8($k) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 2 | utf8::encode($k); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | ( 'u' . length($k) . '.' . $k . ':', $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | ( 'b' . length($k) . '.' . $k . ':', $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 8 | } _encode_bifcode( @$_{@k} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ) . '}'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | ▶ | elsif ( $ref eq 'SCALAR' or $ref eq 'Bifcode::BYTES' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$ref eq "SCALAR" or $ref eq "Bifcode::BYTES"
MC/DC100%2/2
$ref eq "SCALAR" or $ref eq "Bifcode::BYTES"
$ref eq "SCALAR"
$ref eq "Bifcode::BYTES"
Truth table100%3/3
A or B
A= $ref eq "SCALAR"B= $ref eq "Bifcode::BYTES"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 7 | ▶ | $$_ // _croak 'EncodeBytesUndef'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$$_ // _croak("EncodeBytesUndef")
MC/DC0%0/2
$$_ // _croak("EncodeBytesUndef")
$$_
_croak("EncodeBytesUndef")
Truth table66%2/3
A // B
A= $$_B= _croak("EncodeBytesUndef")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 5 | 'b' . length($$_) . '.' . $$_ . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | elsif ( boolean::isBoolean($_) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 5 | ▶ | ( $_ ? 't' : 'f' ) . ','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | elsif ( $ref eq 'Bifcode::INTEGER' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 5 | ▶ | $$_ // _croak 'EncodeIntegerUndef'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$$_ // _croak("EncodeIntegerUndef")
MC/DC0%0/2
$$_ // _croak("EncodeIntegerUndef")
$$_
_croak("EncodeIntegerUndef")
Truth table66%2/3
A // B
A= $$_B= _croak("EncodeIntegerUndef")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 4 | ▶ | _croak 'EncodeInteger', 'invalid integer: ' . $$_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | unless $$_ =~ m/\A (?: 0 | -? [1-9] [0-9]* ) \z/x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 2 | sprintf 'i%s,', $$_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | elsif ( $ref eq 'Bifcode::REAL' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 10 | ▶ | $$_ // _croak 'EncodeRealUndef'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$$_ // _croak("EncodeRealUndef")
MC/DC0%0/2
$$_ // _croak("EncodeRealUndef")
$$_
_croak("EncodeRealUndef")
Truth table66%2/3
A // B
A= $$_B= _croak("EncodeRealUndef")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 9 | ▶ | _croak 'EncodeReal', 'invalid real: ' . $$_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | unless $$_ =~ $number_qr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 8 | ▶ | my $x = 'r' . ( 0 + $1 ) # remove leading zeros | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$3 // 0
$5 // 0
MC/DC100%1/1
$3 // 0
$3
MC/DC100%1/1
$5 // 0
$5
Truth table100%2/2
A
A= $3
Truth table100%2/2
A
A= $5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | . '.' . ( $3 // 0 ) . 'e' . ( 0 + ( $5 // 0 ) ) . ','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 8 | $x =~ s/ ([1-9]) (0+ e)/.${1}e/x; # remove trailing zeros | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 8 | $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | elsif ( $ref eq 'Bifcode::UTF8' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 4 | ▶ | my $str = $$_ // _croak 'EncodeUTF8Undef'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$$_ // _croak("EncodeUTF8Undef")
MC/DC0%0/2
$$_ // _croak("EncodeUTF8Undef")
$$_
_croak("EncodeUTF8Undef")
Truth table33%1/3
A // B
A= $$_B= _croak("EncodeUTF8Undef")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 3 | utf8::encode($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 3 | 'u' . length($str) . '.' . $str . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 7 | elsif ( eval { $_->is_nan } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 2 | 'N,'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 6 | elsif ( eval { $_->is_inf } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 3 | ▶ | $_->is_pos ? '+,' : '-,'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 4 | elsif ( my $a = eval { [ $_->is_int ] } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 3 | ▶ | $a->[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | ? 'i' . $_->bdstr() . ',' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | : 'r' . $_->bnstr() . ','; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | _croak 'EncodeUnhandled', 'unhandled data type: ' . $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 76 | ▶ | sub encode_bifcode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encode_bifcode: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 76 | ▶ | if ( ( @_ == 2 ) && pop ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
@_ == 2 and pop()
MC/DC0%0/2
@_ == 2 and pop()
@_ == 2
pop()
Truth table33%1/3
A and B
A= @_ == 2B= pop()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 1 | my $b = (&_encode_bifcode)[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 1 | 'B' . length($b) . '.' . $b . ','; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | elsif ( @_ == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 73 | (&_encode_bifcode)[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 4 | _croak 'EncodeUsage'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 17 | ▶ | sub force_bifcode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
force_bifcode: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 17 | my $ref = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 17 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 17 | ▶ | _croak 'ForceUsage' unless defined $ref and defined $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $ref and defined $type
MC/DC0%0/2
defined $ref and defined $type
defined $ref
defined $type
Truth table33%1/3
A and B
A= defined $refB= defined $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 17 | bless \$ref, 'Bifcode::' . uc($type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 11 | ▶ | sub _expand_bifcode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_expand_bifcode: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 11 | my $bifcode = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 11 | $bifcode =~ s/ ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | [\[\]\{\}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | | ~, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | | (B|u|b) [0-9]+ \. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | | r -? [0-9]+ \. [0-9]+ e -? [0-9]+ , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | | i [0-9]+ , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | ) /\n$1/gmx; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 11 | $bifcode =~ s/ \A \n //mx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 11 | $bifcode . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 8 | ▶ | sub diff_bifcode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
diff_bifcode: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 8 | ▶ | _croak 'DiffUsage' unless @_ >= 2 and @_ <= 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@_ >= 2 and @_ <= 3
MC/DC100%2/2
@_ >= 2 and @_ <= 3
@_ >= 2
@_ <= 3
Truth table100%3/3
A and B
A= @_ >= 2B= @_ <= 3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 6 | my $b1 = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 6 | my $b2 = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 6 | ▶ | my $diff_args = shift || { STYLE => 'Unified' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || {'STYLE', 'Unified'}
MC/DC0%0/1
shift() || {'STYLE', 'Unified'}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 6 | require Text::Diff; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 6 | $b1 = _expand_bifcode($b1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 6 | $b2 = _expand_bifcode($b2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 6 | return Text::Diff::diff( \$b1, \$b2, $diff_args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # Looking for something like "B48." that may be truncated at any point | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 4 | my $qr_bcbc = qr/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | ^ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | ( # 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | B | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | (?: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | \Z | (?: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | ( 0 | [1-9][0-9]* ) # 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | ( \Z | (\.) ) # 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | /x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 1 | ▶ | sub anyevent_read_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
anyevent_read_type: called CC=1 SCAR=4.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 1 | my ( $self, $cb, $maxdepth ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=31.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 1 | ▶ | return unless defined $_[0]->{rbuf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 1 | $_[0]->{rbuf} =~ s/^[\r\n]*//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 1 | ▶ | return unless length $_[0]->{rbuf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $_[0]->{rbuf} =~ $qr_bcbc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | if ( length $3 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | $_[0]->unshift_read( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | chunk => length($1) + $2 + 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 1 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $data = eval { decode_bifcode( $_[1], $maxdepth ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | $_[0]->_error( Errno::EBADMSG(), undef, $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | $cb->( $_[0], $data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | elsif ( not length $1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $_[0]->_error( Errno::EBADMSG() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | return; # not enough data yet | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 1 | ▶ | sub anyevent_write_type { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
anyevent_write_type: called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | encode_bifcode( $_[1], 1 ) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||