Archive-TarGzip
view release on metacpan or search on metacpan
OPEN
$tar_handle = $tar->taropen( $tar_file, $compress, [\%options or\@options]);
The taropen method opens a $tar_file without bringing any of the files
into memory.
If $options{tar_flag} is '>', the taropen method creats a new $tar_file;
otherwise, it opens the $tar_file for reading.
PRINT
$success = $tar->taradd($file_name, $file_contents);
The taradd method appends $file_contents using the name $file_name to
the end of the tar archive file taropen for writing. If $file_contents
is undefined, the taradd method will use the contents from the file
$file_name.
The tarwrite method will remove the first file in the Archive::Tar
memory and append it to the end of the tar archive file taropen for
writing.
The tarwrite method uses the $option{compress} to decide whether use
gzip compress or normal writing of the tar archive file.
READLINE
\%tar_header = $tar->tarread(@file, [\%options or\@options]);
\%tar_header = $tar->tarread(\%options or\@options);
The tarread method reads the next file from the tar archive file taropen
for reading. The tar file header and file contents are returned in the
%tar_header hash along with other information needed for processing by
the Archive::Tar and Archive::TarGzip classes.
If the $option{header_only} exists the tarread method skips the file
contents and it is not return in the %tar_header.
If either the @file or the @{$option{extract_files}} list is present,
the tarread method will check to see if the file is in either of these
lists. If the file name is not in the @files list or the
@{$option{extract_files}} list, the tarread method will set the
$tar_header{skip_file} key and all other %tar_header keys are
indetermined.
If the @{$option{exclude_files}} list is present, the tarread method
will check to see if the file is in this list. If the file name is in
the list, the tarread method will set the $tar_header{skip_file} key and
all other %tar_header keys are indetermined.
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
devminor
prefix
error
end_of_tar
header_only
skip_file
data
file_position
target
$status = $tar->target( \$buffer, $size);
The target method gets bytes in 512 byte chunks from the tar archive
file taropen for reading. If \$buffer is undefined, the target method
skips over the $size bytes and any additional bytes to pad out to 512
byte boundaries.
The target method uses the $option{compress} to decide whether use gzip
uncompress or normal reading of the tar archive file.
CLOSE
$success = $tar->CLOSE( );
This closes the tar archive opened by the OPEN subroutine.
parse_header
\%tar_header = Archive::TarGzip->parse_header($buffer) ;
\%tar_header = parse_header($buffer); # only if imported
The "parse_header" subroutine takes the pack 512 byte tar file header
and parses it into a the "Archive::Tar" header hash with a few
additional hash keys. This is the return for the "READLINE" subroutine.
REQUIREMENTS
Someday
DEMONSTRATION
#########
# perl TarGzip.d
###
~~~~~~ Demonstration overview ~~~~~
The results from executing the Perl Code follow on the next lines as
comments. For example,
2 + 2
( run in 0.852 second using v1.01-cache-2.11-cpan-5735350b133 )