NAME

Meta::Archive::MyTar - Tar archive module.

COPYRIGHT

Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

DETAILS

MANIFEST: MyTar.pm
PROJECT: meta
VERSION: 0.14

SYNOPSIS

package foo;
use Meta::Archive::MyTar qw();
my($object)=Meta::Archive::MyTar->new();
my($result)=$object->method();

DESCRIPTION

This module allows you to create tar archives much line the CPAN Archive::Tar module. The difference is that this module stores the archive on the disk and not in RAM and therefore is supposed to have more performance. It also supports more operations.

I would rather follow a different path than the code here and do one of the following: 1. use some kind of libtar.so which provides tar functionality. Unfortunately, this type of thing is not currently available. 2. write the target tar file from the beginging and add files to it using the tar command line. But unfortunately the tar command line interface does not support some of the features that I need (the main one being "here is a file but I want you to put it in the archive under a completely different name). Therefore the algorithm I'm following here is much more naive - I open a temp directory and do all thw work there.

This method also allows me to support these types of compressions: 1. bzip2 with extension .bz2 (--bzip2 flag to tar). 2. gzip with extension .gz (--gzip flag to tar). 3. zip with extension .zip (--compress flag to tar). 4. none no compression.

The module works with GNU tar so your mileage with other tar implementations will vary.

This module also uses the tardy program by Peter Miller to set uname and gname after the fact.

This module also maintains a set with all files that currently went into the archive so that files won't be added more than once.

FUNCTIONS

BEGIN()
init($)
add_file($$$)
add_deve($$$)
add_data($$$)
list_files($)
write($$)
TEST($)

FUNCTION DOCUMENTATION

BEGIN()

This is a constructor for the Meta::Archive::MyTar object. It builds accessor methods for the following attributes: type,uname,gname,uid,gid.

init($)

This method does further initialization of the class.

add_file($$$)

This method will add a file to the archive. The file in question is read and copied to the temp directory we are working with under the required name. Maybe we could symlink here instead of copying ? It could be faster (or even hardlink...).

add_deve($$$)

This method will add a development file to the archive under a different name. This method just tranlates the development module name to a file name and uses the add_file method.

add_data($$$)

This method will add some explicit data to the archive under a certain file name.

list_files($)

Get a list of all files in the archive.

write($$)

This method will write the archive to the specified file. The format is tar.gz. This method calls the tar executable to perform the work.

TEST($)

This is a test suite for the Meta::Archive::MyTar package. Currently it just creates an archive with some data and then lists it's content.

SUPER CLASSES

None.

BUGS

None.

AUTHOR

Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER

HISTORY

0.00 MV fix database problems
0.01 MV md5 project
0.02 MV database
0.03 MV perl module versions in files
0.04 MV movies and small fixes
0.05 MV thumbnail project basics
0.06 MV thumbnail user interface
0.07 MV import tests
0.08 MV more thumbnail issues
0.09 MV website construction
0.10 MV web site development
0.11 MV web site automation
0.12 MV SEE ALSO section fix
0.13 MV teachers project
0.14 MV md5 issues

SEE ALSO

Meta::Baseline::Aegis(3), Meta::Class::MethodMaker(3), Meta::Ds::Array(3), Meta::Ds::Set(3), Meta::Info::Enum(3), Meta::Utils::File::Copy(3), Meta::Utils::File::Remove(3), Meta::Utils::System(3), Meta::Utils::Utils(3), strict(3)

TODO

-support compression parameters for each compression algorithm (for instance 1..9, best compression level for gzip etc...).

-use links (hard ?, soft?) instead of copying the files.

-why am I using tardy and not just using the owner and group parameters to tar ? (the code is already here and remarked). Is it because tar will leave them numeric and not symbolic ? If so then document this.