in reply to Re: List Wrapper for Object Methods.
in thread List Wrapper for Object Methods.
Archive - Manage Archives as Objects.
use Archive;
## create a Archive object supplying all information needed
my $force = 1;
my $arch = Archive->new( archive => $full_path_archive
, source_dir => $source_directory
, file_glob => '.'
, log_file => $log_object ## a LogFile object (see LogFile.pm)
);
## create a physical Archive using 'gtar czvf'
$arch->prepare_create(force=>$force);
$arch->create;
## or
## extract a physical Archive using 'gtar xzvf'
$arch->prepare_extract;
$arch->extract;
## or
## remove a physical Archive using 'rm -f'
$arch->remove;
## You can create a list of Archive objects as Archive::List object
my $arch_list = Archive::List->new;
## and add Archive objects to the list
$arch_list->add($arch);
$arch_list->add($brch);
## now you can use all Archive methods also on all members of a Archive::List object
$arch_list->prepare_create;
$arch_list->create;
Use Archive to create, extract or remove archives.
Create a Archive object.
The check_archive Function checks whether an archive exists and refuses to overwrite it unless we set the parameter 'force'. It also checks whether the directory of the archive-to-be exists, is really a directory and is writeable for this user.
The create Function actually creates a physical gtar-ed archive.
The prepare_extract Function checks whether an archive exists and whether the target directory of the extraction exists, is really a directory and is writeable for this user.
The extract Function actually restores all files contained in a gtar-ed archive.
The remove Function removes a gtar-ed archive.
Create a Archive::List object.
Adds a Archive object to the Archive::List object that invoked the method.
These methods called on a Archive::List object do the same for all Archive objects in the list.
|
|---|