Archive-TarGzip
view release on metacpan or search on metacpan
If the tarread method reaches the end of the tar archive file, it will
set the $tar_header{end_of_tar} key and all other %tar_header keys are
indermeined.
The $tar_header keys are as follows:
name
mode
uid
gid
size
mtime
chksum
typeflag
linkname
magic
version
uname
gname
devmajor
lib/Archive/TarGzip.pm view on Meta::CPAN
$prefix="";
}
my $umask = $self->{TarGzip}->{umask};
$umask = umask unless $umask;
my $size = length($file_contents);
my $tar_contents = pack("a100a8a8a8a12a12a8a1a100",
$file_name,
sprintf("%6o ",($file_contents ? 0666 : 0777) & (0777-umask)), # mode
sprintf("%6o ",0), # uid
sprintf("%6o ",0), # gid
sprintf("%11o ",$size),
sprintf("%11o ",time()), # mtime
" ", # chksum
0, # typeflag
''); # linkname
$tar_contents .= pack("a6", "ustar\0"); # magic
$tar_contents .= '00'; # version
$tar_contents .= pack("a32","unknown"); # uname
$tar_contents .= pack("a32","unknown"); # gname
$tar_contents .= pack("a8",sprintf("%6o ",0)); # minor device
lib/Archive/TarGzip.pm view on Meta::CPAN
########
# Apparently this should really be two blocks of 512 zeroes,
# but GNU tar sometimes gets it wrong. See comment in the
# source code (tar.c) to GNU cpio.
return { end_of_tar => 1 } if $header eq "\0" x 512; # End of tar file
my ($name, # string
$mode, # octal number
$uid, # octal number
$gid, # octal number
$size, # octal number
$mtime, # octal number
$chksum, # octal number
$typeflag, # character
$linkname, # string
$magic, # string
$version, # two bytes
$uname, # string
$gname, # string
$devmajor, # octal number
$devminor, # octal number
$prefix) = unpack($tar_unpack_header, $header);
$mode = oct $mode;
$uid = oct $uid;
$gid = oct $gid;
$size = oct $size;
$mtime = oct $mtime;
$chksum = oct $chksum;
$devmajor = oct $devmajor;
$devminor = oct $devminor;
$name = $prefix."/".$name if $prefix;
$prefix = "";
#########
# some broken tar-s don't set the typeflag for directories
lib/Archive/TarGzip.pm view on Meta::CPAN
my $end_of_tar = 0;
# Guard against tarfiles with garbage at the end
$end_of_tar = 1 if $name eq '';
warn( $error ) if $error;
return {
name => $name,
mode => $mode,
uid => $uid,
gid => $gid,
size => $size,
mtime => $mtime,
chksum => $chksum,
typeflag => $typeflag,
linkname => $linkname,
magic => $magic,
version => $version,
uname => $uname,
gname => $gname,
devmajor => $devmajor,
lib/Archive/TarGzip.pm view on Meta::CPAN
If the tarread method reaches the end of the tar archive
file, it will set the $tar_header{end_of_tar} key and
all other %tar_header keys are indermeined.
The $tar_header keys are as follows:
name
mode
uid
gid
size
mtime
chksum
typeflag
linkname
magic
version
uname
gname
devmajor
( run in 0.731 second using v1.01-cache-2.11-cpan-ceb78f64989 )