NAME

PAR::WebStart::Util - Utility functions for PAR::WebStart

SYNOPSIS

use PAR::WebStart::Util qw(make_par verifyMD5);

Description

This module exports, on request, some utility functions used by PAR::WebStart. Available functions are described below.

make_par

This function, used as

my ($par, $md5) = make_par(%opts);

makes a par file suitable for use with PAR::WebStart. If successful, it returns the name of the created par and md5 checksum file.

The files included in the archive will be those under a arch, lib, script, and/or bin subdirectory; these are normally created when making a CPAN-like distribution beneath the blib subdirectory. The steps carried out are

  • Make a MANIFEST file.

  • Use Module::Signature to sign the files, unless the --no-sign option is passed.

  • Use Archive::Zip to create the zip file.

  • Use Digest::MD5 to create an md5 checksum file; this will have the same name as the par file with an .md5 extension added.

The available options are as follows:

src_dir => /some/src

This specifies the source directory to be used. If such a directory has beneath it a blib subdirectory, the blib subdirectory will be used. If this is not specified, the current directory, or a blib subdirectory in the current directory, will be used.

dst_dir => /some/dst

This specifies the destination directory for where to write the par and md5 checksum files. If not specified, the directory used for the src_dir will be used.

name => SomeName

This specifies the name to be used in creating the par archive (a .par extension will automatically be added). If this is not specified, the name will be derived from the directory used for the src_dir.

no_sign => 1

This specifies that the par file should not be signed using Module::Signature. If this is not specified, such signing will occur.

verifyMD5

This performs a check of a file against an md5 checksum. It returns 1 if the check was successful, otherwise an string describing the encountered error is returned. It is used as

my $status = verifyMD5(md5 => 'some_file.md5', file => 'some_file');
unless ($status == 1) {
  die "An error was encountered: $status";
}

The options used are

file => $file

This specifies the source file.

md5 => $md5

This specifies the file containing the md5 checksum, to be used to compare to the md5 checksum computed from the file specified in the file option.

COPYRIGHT

Copyright, 2005, by Randy Kobes <r.kobes@uwinnipeg.ca>. This software is distributed under the same terms as Perl itself.

SEE ALSO

PAR::WebStart, PAR, and Module::Signature.