NAME
Archive::Zip::Tree -- methods for adding/extracting trees using Archive::Zip
SYNOPSIS
use Archive::Zip;
use Archive::Zip::Tree;
my $zip = Archive::Zip->new();
# add all readable files below . as xyz/*
$zip->addTree( '.', 'xyz', { -r $_[0] } );
# add all .c files below /tmp as stuff/*
$zip->addTreeMatching( '/tmp', 'stuff', '\.c$' );
# now extract the same files
$zip->extractTree( 'stuff', '/tmp' );
$zip->writeToFile('xxx.zip');
METHODS
- $zip->addTree( $root, $dest [,$pred] )
-
$root is the root of the tree of files and directories to be added
$dest is the name for the root in the zip file (undef or blank means to use relative pathnames)
$pred is an optional subroutine reference to select files: it is passed the name of the prospective file or directory, and if it returns true, the file or directory will be included. The default is to add all readable files and directories.
To use absolute pathnames, just do:
$zip->addTree( $root, $root );
Returns AZ_OK on success.
Note that this will not follow symbolic links to directories.
Note also that this does not check for the validity of filenames.
- $zip->addTreeMatching( $root, $dest, $pattern [,$pred] )
-
$root is the root of the tree of files and directories to be added
$dest is the name for the root in the zip file (undef means to use relative pathnames)
$pattern is a (non-anchored) regular expression for filenames to match
$pred is an optional subroutine reference to select files: it is passed the name of the prospective file or directory, and if it returns true, the file or directory will be included. The default is to add all readable files and directories.
To use absolute pathnames, just do:
$zip->addTreeMatching( $root, $root, $pattern );
Returns AZ_OK on success.
Note that this will not follow symbolic links to directories.
- $zip->extractTree( $root, $dest [,$pred] )
-
Extracts all the members below a given root. Will translate that root to a given dest pathname.
AUTHOR
Ned Konz, perl@bike-nomad.com
COPYRIGHT
Copyright (c) 2000 Ned Konz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.