The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mozilla::Backup::Plugin::Zip - A zip archive plugin for Mozilla::Backup

SYNOPSIS

  use Mozilla::Backup;

  my $moz = Mozilla::Backup->new(
    plugin => 'Mozilla::Backup::Plugin::Zip'
  );
  

DESCRIPTION

This is a plugin for Mozilla::Backup which allows backups to be saved as zip files.

Methods will return a true value on sucess, or false on failure. (The "false" value is overloaded to return a string value with the error code.)

Methods are outlined below:

new
  $plugin = Mozilla::Backup::Plugin::Zip->new( %options );

The following %options are supported:

log

The Log::Dispatch objetc used by Mozilla::Backup. This is required.

debug

The debug flag from Mozilla::Backup. This is not used at the moment.

compression

The desired compression level to use when backing up files, between 0 and 9. 0 means to store (not compress) files, 1 is for the fastest method with the lowest compression, and 9 is for the slowest method with the fastest compression. (The default is 6.)

See the Archive::Zip documentation for more information on levels.

allowed_options
  @options = Mozilla::Backup::Plugin::Zip->allowed_options();

  if (Mozilla::Backup::Plugin::Zip->allowed_options('debug')) {
    ...
  }

If no arguments are given, it returns a list of configuration parameters that can be passed to the constructor. If arguments are given, it returns true if all of the arguments are allowable options for the constructor.

munge_location
  $filename = $plugin->munge_location( $filename );

Munges the archive name by adding the "zip" extension to it, if it does not already have it. If called with no arguments, just returns ".zip".

open_for_backup
  if ($plugin->open_for_backup( $filename, %options )) {
    ...
  }

Creates a new archive for backing the profile. $filename is the name of the archive file to be used. %options are optional configuration parameters.

open_for_restore
  if ($plugin->open_for_restore( $filename, %options )) {
    ...
  }

Opens an existing archive for restoring the profile.

get_contents
  @files = $plugin->get_contents;

Returns a list of files in the archive. Assumes it has been opened for restoring (may or may not work for archives opened for backup; applications are expected to track files backed up separately).

backup_file
  $plugin->backup_file( $local_file, $internal_name );

Backs up the file in the archive, using $internal_name as the name in the archive. Assumes it has been opened for backup.

restore_file
  $plugin->restore_file( $internal_name, $local_file );

Restores the file from the archive. Assumes it has been opened for restoring.

close_backup
  $plugin->close_backup();

Closes the backup.

close_restore
  $plugin->close_restore();

Closes the restore.

KNOWN ISSUES

MozBackup Compatability

The "MozBackup" utility (http://backup.jasnapaka.com) produces zip archives (with the pcv extension) which should be compatible with this module, although support for handling the indexfiles.txt has not been added (it should probably be exluded in a restore).

AUTHOR

Robert Rothenberg <rrwo at cpan.org>

LICENSE

Copyright (c) 2005 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.