| 1 | package Skilletor::Tar; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: The reference's minimal tar reader: safe file and dir entries only | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 37 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 37 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 37 | ▶ | use Exporter qw( import ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 37 | ▶ | use Skilletor::Error; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 37 | ▶ | use Skilletor::Error::Tar; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 37 | ▶ | use Skilletor::FSUtil qw( decode_utf8_lossy is_executable ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 37 | ▶ | use Skilletor::JSString qw( js_trim ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 37 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 37 | our @EXPORT_OK = qw( parse_tar strip_top_level is_reserved VERSION_FILE ); | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | # The version of a url cache's tree, at the root of the tree (reserved there). | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 37 | ▶ | use constant VERSION_FILE => '.skilletor-version'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 289 | ▶ | sub _read_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_string: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 289 | my ( $bytes, $offset, $length ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 289 | my $raw = substr $bytes, $offset, $length; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 289 | my $end = index $raw, "\0"; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 289 | ▶ | return decode_utf8_lossy( $end == -1 ? $raw : substr( $raw, 0, $end ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # parseInt(s, 8) of the trimmed field: NaN (undef) when no octal digit leads it. | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 144 | ▶ | sub _read_octal { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_octal: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 144 | my ( $bytes, $offset, $length ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 144 | my $s = js_trim( _read_string( $bytes, $offset, $length ) ); | |||||||||||||||||||||||||||||||||||||||||
| 31 | 144 | ▶ | return 0 if $s eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 143 | ▶ | return undef unless $s =~ /\A([-+]?)([0-7]+)/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 140 | my $v = oct $2; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 140 | ▶ | return $1 eq '-' ? -$v : $v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | ▶ | sub _pax_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_pax_path: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | my ( $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | for my $line ( split /\n/, decode_utf8_lossy($data), -1 ) { | |||||||||||||||||||||||||||||||||||||||||
| 40 | 2 | ▶ | return $1 if $line =~ /\A[0-9]+ path=([^\n\r\x{2028}\x{2029}]*)\z/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 54 | ▶ | sub _assert_safe { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_assert_safe: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 54 | my ( $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 54 | ▶ | if ( $name eq '' || $name =~ m{\A[/\\]} || $name =~ /\A[a-zA-Z]:/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$name eq "" or $name =~ m(\A[/\\]) or $name =~ /\A[a-zA-Z]:/
$name eq "" or $name =~ m(\A[/\\])
MC/DC100%3/3
$name eq "" or $name =~ m(\A[/\\]) or $name =~ /\A[a-zA-Z]:/
$name eq ""
$name =~ m(\A[/\\])
$name =~ /\A[a-zA-Z]:/
Truth table100%4/4
A or B or C
A= $name eq ""B= $name =~ m(\A[/\\])C= $name =~ /\A[a-zA-Z]:/
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 4 | ▶ | Skilletor::Error::Tar->throw( 'unsafe tar entry (absolute path): '.( length $name ? $name : '<empty>' ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 50 | ▶ | if ( grep { $_ eq '..' } split m{/}, $name, -1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | Skilletor::Error::Tar->throw( 'unsafe tar entry (path traversal): '.$name ); | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | # A decompressed tar as safe entries: { name, type => 'file' | 'dir', data, executable }. | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 34 | ▶ | sub parse_tar { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_tar: called CC=22 SCAR=30.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 34 | my ( $buf ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 34 | my @entries; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 34 | my $len = length $buf; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 34 | my $offset = 0; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 34 | my ( $long_name, $pax_path ); | |||||||||||||||||||||||||||||||||||||||||
| 62 | 34 | my $ended = 0; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 34 | ▶ | while ( $offset + 512 <= $len ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 85 | my $block = substr $buf, $offset, 512; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 85 | ▶ | if ( $block !~ /[^\0]/ ) { # end of archive | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 13 | $ended = 1; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 13 | last; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 72 | my $raw_name = _read_string( $block, 0, 100 ); | |||||||||||||||||||||||||||||||||||||||||
| 71 | 72 | my $mode = _read_octal( $block, 100, 8 ); | |||||||||||||||||||||||||||||||||||||||||
| 72 | 72 | my $prefix = _read_string( $block, 345, 155 ); | |||||||||||||||||||||||||||||||||||||||||
| 73 | 72 | my $size = _read_octal( $block, 124, 12 ); | |||||||||||||||||||||||||||||||||||||||||
| 74 | 72 | my $typeflag = substr $block, 156, 1; | |||||||||||||||||||||||||||||||||||||||||
| 75 | # A size that parses negative would step back over this header for ever, a non-octal one | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # (NaN) would end the walk quietly: corrupt like a failed gunzip, not unsafe – a plain error, so | ||||||||||||||||||||||||||||||||||||||||||
| 77 | # a url source falls back to its cache. | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 72 | ▶ | Skilletor::Error->throw( 'corrupt tar entry (size): '.$raw_name ) unless defined $size && $size >= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $size and $size >= 0
MC/DC100%2/2
defined $size and $size >= 0
defined $size
$size >= 0
Truth table100%3/3
A and B
A= defined $sizeB= $size >= 0
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 65 | $offset += 512; | |||||||||||||||||||||||||||||||||||||||||
| 80 | # k145: a stream cut short inside an entry's data (or its padding) is no smaller archive. | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 65 | ▶ | Skilletor::Error->throw( 'corrupt tar (truncated): '.$raw_name ) if $offset + _ceil_blocks($size) > $len; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 63 | ▶ | my $data = $size > 0 ? substr( $buf, $offset, $size ) : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 63 | $offset += _ceil_blocks($size); | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 63 | ▶ | if ( $typeflag eq 'L' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | ( $long_name = _read_string( $data, 0, length $data ) ) =~ s/\0+\z//; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 62 | ▶ | if ( $typeflag eq 'x' || $typeflag eq 'g' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$typeflag eq "x" or $typeflag eq "g"
MC/DC50%1/2
$typeflag eq "x" or $typeflag eq "g"
$typeflag eq "x"
$typeflag eq "g"
Truth table66%2/3
A or B
A= $typeflag eq "x"B= $typeflag eq "g"
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | ▶ | $pax_path = _pax_path($data) // $pax_path; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
_pax_path($data) // $pax_path
MC/DC0%0/2
_pax_path($data) // $pax_path
_pax_path($data)
$pax_path
Truth table33%1/3
A // B
A= _pax_path($data)B= $pax_path
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 60 | ▶ | if ( $typeflag eq '2' || $typeflag eq '1' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$typeflag eq 2 or $typeflag eq 1
MC/DC100%2/2
$typeflag eq 2 or $typeflag eq 1
$typeflag eq 2
$typeflag eq 1
Truth table100%3/3
A or B
A= $typeflag eq 2B= $typeflag eq 1
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 4 | Skilletor::Error::Tar->throw( 'unsafe tar entry (symlink/hardlink): '.$raw_name ); | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 56 | ▶ | my $name = $pax_path // $long_name // ( length $prefix ? $prefix.'/'.$raw_name : $raw_name ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
($pax_path // $long_name) // (length $prefix ? $prefix . '/' . $raw_name : $raw_name)
$pax_path // $long_name
MC/DC0%0/3
($pax_path // $long_name) // (length $prefix ? $prefix . '/' . $raw_name : $raw_name)
$pax_path
$long_name
(length $prefix ? $prefix . '/' . $raw_name : $raw_name)
Truth table75%3/4
A // B // C
A= $pax_pathB= $long_nameC= (length $prefix ? $prefix . '/' . $raw_name : $raw_name)
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 56 | undef $long_name; | |||||||||||||||||||||||||||||||||||||||||
| 98 | 56 | undef $pax_path; | |||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 56 | ▶ | next if $typeflag ne '0' && $typeflag ne "\0" && $typeflag ne '5'; # devices etc. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$typeflag ne 0 and $typeflag ne "\0" and $typeflag ne 5
$typeflag ne 0 and $typeflag ne "\0"
MC/DC66%2/3
$typeflag ne 0 and $typeflag ne "\0" and $typeflag ne 5
$typeflag ne 0
$typeflag ne "\0"
$typeflag ne 5
Truth table75%3/4
A and B and C
A= $typeflag ne 0B= $typeflag ne "\0"C= $typeflag ne 5
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 54 | _assert_safe($name); | |||||||||||||||||||||||||||||||||||||||||
| 102 | 49 | ▶ | if ( $typeflag eq '5' || $name =~ m{/\z} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$typeflag eq 5 or $name =~ m[/\z]
MC/DC100%2/2
$typeflag eq 5 or $name =~ m[/\z]
$typeflag eq 5
$name =~ m[/\z]
Truth table100%3/3
A or B
A= $typeflag eq 5B= $name =~ m[/\z]
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 9 | ( my $dir = $name ) =~ s{/+\z}{}; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 9 | push @entries, { name => $dir, type => 'dir', data => '', executable => 0 }; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 40 | push @entries, { name => $name, type => 'file', data => $data, executable => is_executable($mode) }; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # k145: every archive ends with a zero block; running out of bytes first is a truncated one. | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 16 | ▶ | Skilletor::Error->throw('corrupt tar (truncated: no end-of-archive marker)') unless $ended; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 13 | return \@entries; | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 128 | ▶ | sub _ceil_blocks { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ceil_blocks: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 128 | my ( $size ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 128 | my $blocks = int( $size / 512 ); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 128 | ▶ | $blocks++ if $size > 0 && $size % 512; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$size > 0 and $size % 512
MC/DC50%1/2
$size > 0 and $size % 512
$size > 0
$size % 512
Truth table66%2/3
A and B
A= $size > 0B= $size % 512
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 128 | return $blocks * 512; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | # Strip a single GitHub-style top-level directory, if there is one. | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 12 | ▶ | sub strip_top_level { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
strip_top_level: called CC=8 SCAR=21.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 12 | my ( $entries ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 125 | 12 | my %tops; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 12 | for my $e (@$entries) { | |||||||||||||||||||||||||||||||||||||||||
| 127 | 39 | my ($top) = split m{/}, $e->{name}, 2; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 39 | ▶ | $tops{$top} = 1 if defined $top && length $top; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $top and length $top
MC/DC0%0/2
defined $top and length $top
defined $top
length $top
Truth table33%1/3
A and B
A= defined $topB= length $top
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 12 | my $nested = grep { index( $_->{name}, '/' ) >= 0 } @$entries; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 12 | ▶ | return $entries if keys(%tops) != 1 || !$nested; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
keys %tops != 1 or not $nested
MC/DC100%2/2
keys %tops != 1 or not $nested
keys %tops != 1
not $nested
Truth table100%3/3
A or not(B)
A= keys %tops != 1B= not $nested
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 10 | my ($top) = keys %tops; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 10 | my $prefix = $top.'/'; | |||||||||||||||||||||||||||||||||||||||||
| 134 | return [ | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 36 | grep { length $_->{name} } | |||||||||||||||||||||||||||||||||||||||||
| 136 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 10 | my $n = $_->{name}; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 36 | ▶ | +{ %$_, name => $n eq $top ? '' : index( $n, $prefix ) == 0 ? substr( $n, length $prefix ) : $n }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | } @$entries | ||||||||||||||||||||||||||||||||||||||||||
| 140 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | # An archive entry at the version file's path, or under it: never extracted. | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 27 | ▶ | sub is_reserved { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_reserved: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 27 | my ( $name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 27 | ▶ | my ($first) = grep { $_ ne '' && $_ ne '.' } split m{/}, $name, -1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_ ne '' && $_ ne '.'
MC/DC50%1/2
$_ ne '' && $_ ne '.'
$_ ne ''
$_ ne '.'
Truth table66%2/3
A && B
A= $_ ne ''B= $_ ne '.'
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 27 | ▶ | return ( defined $first && $first eq VERSION_FILE ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $first and $first eq ".skilletor-version"
MC/DC50%1/2
defined $first and $first eq ".skilletor-version"
defined $first
$first eq ".skilletor-version"
Truth table66%2/3
A and B
A= defined $firstB= $first eq ".skilletor-version"
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 37 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | __END__ | ||||||||||||||||||||||||||||||||||||||||||