Branch Coverage

lib/Archive/Tar.pm
Criterion Covered Total %
branch 255 426 59.8


line true false branch
117 117 645 if @_
124 0 82 if ref $class
130 23 59 if (@_)
131 0 23 unless ($obj->read(@_))
211 57 2 if (defined $file) { }
218 0 57 unless my $handle = $self->_get_handle($file, $gzip, sub { ;}->(1))
221 2 55 unless my $data = $self->_read_tar($handle, $opts)
225 5 50 wantarray ? :
230 0 100 unless defined $file
235 0 100 if (ref $file)
236 0 0 if eval { do { *$file{"IO"} } }
237 0 0 if eval { do { $file->isa("IO::Handle") } }
247 69 31 if (sub { ;}->($mode))
248 0 69 unless (open my $tmp, $file)
262 20 80 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' }) { }
66 14 elsif ($compress or sub { package Archive::Tar::Constant; use warnings; $_[0] =~ /^r/ ? 1 : 0; } ->($mode) or $magic =~ /^(?:\037\213|\037\235)/) { }
286 89 11 unless $compress eq "bzip2"
293 12 8 if (sub { package Archive::Tar::Constant; use warnings; $_[0] =~ /^r/ ? 1 : 0; } ->($mode)) { }
294 0 12 unless ($fh = "IO::Uncompress::Bunzip2"->new($file, "MultiStream", 1))
302 0 8 unless ($fh = "IO::Compress::Bzip2"->new($file))
319 0 66 unless ($fh->open($file, $mode))
328 0 14 unless ($fh->open($file, $mode))
344 0 84 unless my $handle = shift()
355 28 56 if $count > 0
368 105 618 if (ref $handle ne 'IO::Zlib') { }
377 80 643 unless ($read++)
379 0 80 if ($chunk =~ /$gzip/)
386 2 78 if (length $chunk != 512)
393 3 718 if length $chunk != 512
398 426 292 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\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\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\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\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\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\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\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\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\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\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\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\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"
406 0 292 unless ($nulls eq substr($chunk, 500, 12))
417 63 229 if defined $real_name
419 0 292 unless ($entry = "Archive::Tar::File"->new("chunk", $chunk, %extra_args))
429 0 292 if $entry->is_label
431 214 78 if (length $entry->type and $entry->is_file || $entry->is_longlink)
433 0 214 if ($entry->is_file and not $entry->validate)
438 0 0 if length $name > 100
453 0 214 if ($md5) { }
22 192 elsif ($filter and not $entry->name =~ /$filter/) { }
22 170 elsif ($filter_cb and not &$filter_cb($entry)) { }
1 169 elsif ($entry->name eq 'pax_global_header' or $entry->type =~ /^(x|g)$/) { }
470 45 169 if ($skip) { }
482 45 0 if $this > $amt
483 0 45 if ($handle->read($$data, $this) < $this)
490 45 0 if $fsz < 0
491 0 45 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 169 if ($handle->read($$data, $block) < $block)
506 169 0 if defined $$data
511 63 151 if ($entry->is_longlink)
539 63 229 if ($entry->is_longlink) { }
63 166 elsif (defined $real_name) { }
548 20 209 if ($filter and not $entry->name =~ /$filter/) { }
20 189 elsif ($filter_cb and not &$filter_cb($entry)) { }
1 188 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 188 if $entry->name eq ""
572 9 179 $extract ? :
574 18 170 if ($limit)
575 12 6 unless $entry->is_longlink or $entry->is_dir
576 12 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 287 unless my $entry = shift()
719 161 126 defined $alt ? :
724 161 126 if (defined $alt) { }
734 80 207 if ($vol or 'File::Spec'->file_name_is_absolute($dirs)) { }
738 0 0 unless (defined $alt or $Archive::Tar::INSECURE_EXTRACT_MODE)
753 111 96 ref $self && defined $self->{'cwd'} ? :
755 81 126 defined $alt ? :
760 120 6 unless (defined $alt or $Archive::Tar::INSECURE_EXTRACT_MODE)
766 1 119 if (grep {$_ eq "..";} @dirs)
786 94 15 if ref $self and $self->{'_link_cache'}{$full_path}
788 2 21 if (-l $full_path)
802 13 8 if ref $self
815 204 0 if length $cwd_file
834 0 204 unless (defined $dir)
835 0 0 if $^W
841 0 284 if (-e $dir and not -d _)
842 0 0 if $^W
846 12 272 unless (-d _)
848 1 11 if ($@)
867 18 265 if $entry->is_dir
871 0 265 if ($entry->is_unknown)
884 9 256 if (-l $full or -e _)
885 0 9 unless (unlink $full)
890 259 6 if (length $entry->type and $entry->is_file) { }
892 0 259 unless $fh->open($full, ">")
897 233 26 if ($entry->size)
904 16826 0 if (defined $written) { }
913 0 259 unless close $fh
919 0 6 unless $self->_make_special_file($entry, $full)
925 259 6 unless (-l $full)
926 0 259 unless utime time, $entry->mtime - 0, $full
930 259 6 if ($Archive::Tar::CHOWN and sub { ;}->() and not -l $full)
931 0 259 unless CORE::chown $entry->uid, $entry->gid, $full
937 259 6 if ($Archive::Tar::CHMOD and not -l $full)
939 0 259 unless ($Archive::Tar::SAME_PERMISSIONS)
942 0 259 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 48 unless ($self->_data)
1053 0 0 unless $self->read
1056 48 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 109 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 31 unless defined $file
1320 34 0 unless defined $ext_prefix
1327 0 0 $Archive::Tar::HAS_IO_STRING ? :
3 0 $Archive::Tar::HAS_PERLIO ? :
31 3 length $file ? :
1348 4 86 if ($Archive::Tar::DO_NOT_USE_PREFIX) { }
1352 0 4 length $ext_prefix ? :
1367 0 86 if length $ext_prefix
1381 15 75 if ($make_longlink)
1388 0 15 unless ($longlink)
1412 0 105 if $link_ok
1416 0 105 unless ($header)
1422 0 105 unless (print $handle $header)
1428 81 24 if ($link_ok or $data_ok)
1429 0 81 unless (print $handle $clone->data)
1436 81 0 if $clone->size % 512
1443 0 34 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\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\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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\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\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\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\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\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\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\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\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\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\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\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
1449 3 0 $Archive::Tar::HAS_PERLIO ? :
31 3 length $file ? :
1452 34 0 if ($file ne $handle)
1453 0 34 unless (close $handle)
1464 0 105 unless my $entry = shift()
1465 105 0 unless defined $ext_prefix
1469 0 105 unless defined $prefix
1480 0 105 if length $ext_prefix
1485 7 98 if length $prefix >= 155
1487 0 105 $Archive::Tar::ZERO_PAD_NUMBERS ? :
1504 0 105 $no_prefix ? :
1510 0 105 $Archive::Tar::ZERO_PAD_NUMBERS ? :
1540 0 25 unless my(@files) = @_
1548 28 16 if (UNIVERSAL::isa($file, "Archive::Tar::File"))
1554 0 16 if (utf8::is_utf8($file))
1559 0 16 unless (-e $file or -l $file)
1565 0 16 unless ($obj)
1636 1 14 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 12 unless defined $filename
1821 0 12 unless my $handle = $class->_get_handle($filename, $compressed, sub { ;}->(1))
1830 2 27 if @data
1831 0 27 unless $handle
1835 27 0 if ref $tarfile and ref $tarfile eq "ARRAY"
1836 27 0 unless ($Archive::Tar::RESOLVE_SYMLINK =~ /none/)
1839 1 16 if ($_->linkname)
1847 15 12 if @data
1851 0 12 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