The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


PANT::Zip - PANT support for zipping up files


  use PANT;

  $zipper = Zip(";
  $zipper->AddFile("test-thing", "thing");
  $zipper->AddTree("buildlib", "lib");


  This is part of a module to help construct automated build environments.
  This part is for help zipping up files.


This module is part of a set to help run automated builds of a project and to produce a build log. This part is designed to provide support for zipping up files as needed.

It is really just a thin wrapping layer around Archive::Zip.




new($xml, "");

Constructor for a test object. Requires an XML::Writer object and a zip name as parameters, which it will use for subsequent log construction. The PANT function ZIP calls this constructor with the current xml stream, and passes on the arguments for you. So normally you would call it via the accessor.

AddFile(file, newname)

Adds the given file to the zip, optionally renaming it on the way if a 2nd argument is given.

AddTree(directory, dirname, func)

Adds the given directory tree to the zip, recursively. If the newname is given, then the base directory will be renamed to that. Finally the 3rd parameter if present is a subroutine reference to be called for each prospective file. It can examine $_ and return true/false to add it.


Set the overall archive compression number. This is a number between 0 and 9, 0 being no compression, and 9 being maximum compression.


Uses Archive::Zip for the zip operations. Makes use of XML::Writer to construct the build log.


Julian Onions, <>


Copyright 2005 by Julian Onions

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.