Branch Coverage

lib/Archive/Tar.pm
Criterion Covered Total %
branch 253 426 59.3


line true false branch
117 99 620 if @_
124 0 77 if ref $class
130 14 63 if (@_)
131 0 14 unless ($obj->read(@_))
211 48 2 if (defined $file) { }
218 0 48 unless my $handle = $self->_get_handle($file, $gzip, sub { package Archive::Tar::Constant; use warnings; use strict; shift() ? 'rb' : 'r';}->(1))
221 2 46 unless my $data = $self->_read_tar($handle, $opts)
225 5 41 wantarray ? :
230 0 93 unless defined $file
235 0 93 if (ref $file)
236 0 0 if eval { do { *$file{"IO"} } }
237 0 0 if eval { do { $file->isa("IO::Handle") } }
247 63 30 if (sub { package Archive::Tar::Constant; use warnings; use strict; $_[0] =~ /^r/ ? 1 : 0;}->($mode))
248 0 63 unless (open my $tmp, $file)
262 17 76 if (do { sub { package Archive::Tar::Constant; use warnings; $_[0] =~ /^r/ ? 1 : 0; } ->($mode) and $magic =~ /^\x42\x5A\x68[\x30-\x39]/ unless $compress eq 'bzip2' }) { }
61 15 elsif ($compress or sub { package Archive::Tar::Constant; use warnings; $_[0] =~ /^r/ ? 1 : 0; } ->($mode) or $magic =~ /^(?:\037\213|\037\235)/) { }
286 83 10 unless $compress eq "bzip2"
293 10 7 if (sub { package Archive::Tar::Constant; use warnings; $_[0] =~ /^r/ ? 1 : 0; } ->($mode)) { }
294 0 10 unless ($fh = "IO::Uncompress::Bunzip2"->new($file, "MultiStream", 1))
302 0 7 unless ($fh = "IO::Compress::Bzip2"->new($file))
319 0 61 unless ($fh->open($file, $mode))
328 0 15 unless ($fh->open($file, $mode))
344 0 81 unless my $handle = shift()
355 34 47 if $count > 0
368 81 535 if (ref $handle ne 'IO::Zlib') { }
377 77 539 unless ($read++)
379 0 77 if ($chunk =~ /$gzip/)
386 2 75 if (length $chunk != 512)
393 2 612 if length $chunk != 512
398 370 242 if $chunk eq "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0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, %extra_args))
429 0 242 if $entry->is_label
431 184 58 if (length $entry->type and $entry->is_file || $entry->is_longlink)
433 0 184 if ($entry->is_file and not $entry->validate)
438 0 0 if length $name > 100
453 0 184 if ($md5) { }
22 162 elsif ($filter and not $entry->name =~ /$filter/) { }
22 140 elsif ($filter_cb and not &$filter_cb($entry)) { }
0 140 elsif ($entry->name eq 'pax_global_header' or $entry->type =~ /^(x|g)$/) { }
470 44 140 if ($skip) { }
482 44 0 if $this > $amt
483 0 44 if ($handle->read($$data, $this) < $this)
490 44 0 if $fsz < 0
491 0 44 if $skip == 5
493 0 0 if $skip == 5 and not $entry->is_longlink and not $entry->is_unknown and not $entry->is_label
500 0 140 if ($handle->read($$data, $block) < $block)
506 140 0 if defined $$data
511 51 133 if ($entry->is_longlink)
539 51 191 if ($entry->is_longlink) { }
51 140 elsif (defined $real_name) { }
548 20 171 if ($filter and not $entry->name =~ /$filter/) { }
20 151 elsif ($filter_cb and not &$filter_cb($entry)) { }
0 151 elsif ($entry->name eq 'pax_global_header' or $entry->type =~ /^(x|g)$/) { }
561 9 0 if ($extract and not $entry->is_longlink and not $entry->is_unknown and not $entry->is_label)
564 0 9 unless $self->_extract_file($entry)
568 0 151 if $entry->name eq ""
572 9 142 $extract ? :
574 21 130 if ($limit)
575 15 6 unless $entry->is_longlink or $entry->is_dir
576 15 6 unless $count
601 0 2 unless defined $full
606 1 1 if $self->_find_entry($full)
635 32 0 unless $self->{'cwd'}
638 2 30 if (@args) { }
642 1 1 if (UNIVERSAL::isa($file, 'Archive::Tar::File')) { }
654 1 0 if (exists $hashmap->{$file}) { }
670 0 32 unless (scalar @files)
677 3 108 unless ($self->_extract_file($entry))
704 0 165 unless defined $file
707 0 165 unless my $entry = $self->_find_entry($file)
715 0 288 unless my $entry = shift()
719 161 127 defined $alt ? :
724 161 127 if (defined $alt) { }
734 80 208 if ($vol or 'File::Spec'->file_name_is_absolute($dirs)) { }
738 0 0 unless (defined $alt or $Archive::Tar::INSECURE_EXTRACT_MODE)
753 111 97 ref $self && defined $self->{'cwd'} ? :
755 81 127 defined $alt ? :
760 121 6 unless (defined $alt or $Archive::Tar::INSECURE_EXTRACT_MODE)
766 1 120 if (grep {$_ eq "..";} @dirs)
786 94 15 if ref $self and $self->{'_link_cache'}{$full_path}
788 2 24 if (-l $full_path)
802 13 11 if ref $self
815 205 0 if length $cwd_file
834 0 205 unless (defined $dir)
835 0 0 if $^W
841 0 285 if (-e $dir and not -d _)
842 0 0 if $^W
846 12 273 unless (-d _)
848 1 11 if ($@)
867 18 266 if $entry->is_dir
871 0 266 if ($entry->is_unknown)
884 9 257 if (-l $full or -e _)
885 0 9 unless (unlink $full)
890 260 6 if (length $entry->type and $entry->is_file) { }
892 0 260 unless $fh->open($full, ">")
897 234 26 if ($entry->size)
904 16827 0 if (defined $written) { }
913 0 260 unless close $fh
919 0 6 unless $self->_make_special_file($entry, $full)
925 260 6 unless (-l $full)
926 0 260 unless utime time, $entry->mtime - 0, $full
930 260 6 if ($Archive::Tar::CHOWN and sub { package Archive::Tar::Constant; use warnings; use strict; $^O ne 'MSWin32' if $> == 0 and $^O ne 'MacOS';}->() and not -l $full)
931 0 260 unless CORE::chown $entry->uid, $entry->gid, $full
937 260 6 if ($Archive::Tar::CHMOD and not -l $full)
939 0 260 unless ($Archive::Tar::SAME_PERMISSIONS)
942 0 260 unless CORE::chmod $mode, $full
951 0 6 unless my $entry = shift()
952 0 6 unless defined $file
956 6 0 if ($entry->is_symlink) { }
0 0 elsif ($entry->is_hardlink) { }
0 0 elsif ($entry->is_fifo) { }
0 0 elsif ($entry->is_blockdev or $entry->is_chardev) { }
0 0 elsif ($entry->is_socket) { }
959 0 6 unless symlink $entry->linkname, $file
966 0 6 if $fail
972 0 0 unless link $entry->linkname, $file
979 0 0 if $fail
983 0 0 if system "mknod", $file, "p"
987 0 0 $entry->is_blockdev ? :
989 0 0 if system "mknod", $file, $mode, $entry->devmajor, $entry->devminor
1000 0 6 $err ? :
1007 0 0 unless my $entry = shift()
1008 0 0 unless defined $file
1014 0 0 unless ($orig)
1023 0 0 unless $self->_extract_file($clone, $file)
1052 0 38 unless ($self->_data)
1053 0 0 unless $self->read
1056 38 0 if (@$aref == 0 or @$aref == 1 and $aref->[0] eq 'name') { }
1078 0 218 unless (defined $file)
1084 16 202 if UNIVERSAL::isa($file, "Archive::Tar::File")
1087 202 0 if ($self->_data)
1090 199 311 if $path eq $file
1094 3 0 unless ($Archive::Tar::RESOLVE_SYMLINK =~ /none/)
1095 0 3 if (my $link_entry = shift())
1097 0 0 if $self->_data
1102 0 0 if ($Archive::Tar::RESOLVE_SYMLINK =~ /speed/ and @$iterargs == 3)
1108 0 0 if ($archive->_data)
1118 0 0 if ($e->full_path eq $file)
1145 105 4 unless @_
1163 0 11 unless my $entry = $self->_find_entry(shift())
1176 0 1 unless my $entry = $self->_find_entry(shift())
1194 0 2 unless defined $file
1195 0 2 unless defined $new
1197 0 2 unless my $entry = $self->_find_entry($file)
1212 0 1 unless defined $file
1213 0 1 unless defined $mode and $mode =~ /^[0-7]{1,4}$/
1216 0 1 unless my $entry = $self->_find_entry($file)
1231 0 2 unless defined $file
1232 0 2 unless defined $uname
1236 0 2 unless my $entry = $self->_find_entry($file)
1270 0 2 unless my $self = shift()
1318 3 30 unless defined $file
1320 33 0 unless defined $ext_prefix
1327 0 0 $Archive::Tar::HAS_IO_STRING ? :
3 0 $Archive::Tar::HAS_PERLIO ? :
30 3 length $file ? :
1348 4 70 if ($Archive::Tar::DO_NOT_USE_PREFIX) { }
1352 0 4 length $ext_prefix ? :
1367 0 70 if length $ext_prefix
1381 9 65 if ($make_longlink)
1388 0 9 unless ($longlink)
1412 0 83 if $link_ok
1416 0 83 unless ($header)
1422 0 83 unless (print $handle $header)
1428 70 13 if ($link_ok or $data_ok)
1429 0 70 unless (print $handle $clone->data)
1436 70 0 if $clone->size % 512
1443 0 33 unless print $handle "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0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)
1453 0 33 unless (close $handle)
1464 0 83 unless my $entry = shift()
1465 83 0 unless defined $ext_prefix
1469 0 83 unless defined $prefix
1480 0 83 if length $ext_prefix
1485 4 79 if length $prefix >= 155
1487 0 83 $Archive::Tar::ZERO_PAD_NUMBERS ? :
1504 0 83 $no_prefix ? :
1510 0 83 $Archive::Tar::ZERO_PAD_NUMBERS ? :
1540 0 25 unless my(@files) = @_
1548 7 22 if (UNIVERSAL::isa($file, "Archive::Tar::File"))
1554 0 22 if (utf8::is_utf8($file))
1559 0 22 unless (-e $file or -l $file)
1565 0 22 unless ($obj)
1636 1 13 unless ($obj)
1666 15 0 if (ref $self)
1673 6 9 if ($Archive::Tar::WARN)
1674 0 6 $Archive::Tar::DEBUG ? :
1682 20 2 if (ref $self) { }
1683 0 20 shift() ? :
1685 0 2 shift() ? :
1774 0 9 unless defined $file
1778 0 9 unless (@files)
1816 0 15 unless defined $filename
1821 0 15 unless my $handle = $class->_get_handle($filename, $compressed, sub { package Archive::Tar::Constant; use warnings; use strict; shift() ? 'rb' : 'r';}->(1))
1830 2 33 if @data
1831 0 33 unless $handle
1835 33 0 if ref $tarfile and ref $tarfile eq "ARRAY"
1836 33 0 unless ($Archive::Tar::RESOLVE_SYMLINK =~ /none/)
1839 1 19 if ($_->linkname)
1847 18 15 if @data
1851 0 15 if (@$CONSTRUCT_ARGS == 4)
1881 0 3 unless defined $file
1885 0 3 unless $tar
1906 0 9 unless defined $file
1909 0 9 unless my $tar = $class->new
1991 0 0 if (@trg and $trg[0] eq "")
1997 0 0 if $part eq "."
1998 0 0 if ($part eq '..') { }
2008 0 0 if $Archive::Tar::DEBUG