View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Andreas J. König > CPAN-Checksums-2.11 > CPAN::Checksums



Annotate this POD


Open  0
View/Report Bugs
Module Version: 2.11   Source   Latest Release: CPAN-Checksums-2.12


CPAN::Checksums - Write a CHECKSUMS file for a directory as on CPAN


  use CPAN::Checksums qw(updatedir);
  my $success = updatedir($directory);


Since version 1.0 the generation of the attribute shortname is turned off by default. It was too slow and was not used as far as I know, and above all, it could fail on large directories. The shortname feature can still be turned on by setting the global variable $TRY_SHORTNAME to a true value.


$success = updatedir($dir)

updatedir() takes a directory name as argument and writes a typical CHECKSUMS file in that directory as used on CPAN unless a previously written CHECKSUMS file is there that is still valid. Returns 2 if a new CHECKSUMS file has been written, 1 if a valid CHECKSUMS file is already there, otherwise dies.

Note: since version 2.0 updatedir on empty directories behaves just the same. In older versions it silently did nothing.

Global Variables in package CPAN::Checksums


If the global variable $IGNORE_MATCH is set, then all files matching this expression will be completely ignored and will not be included in the CPAN CHECKSUMS files. Per default this variable is set to


Setting the global variable $CAUTION causes updatedir() to report changes of files in the attributes size, mtime, md5, or md5-ungz to STDERR.


By setting the global variable $TRY_SHORTNAME to a true value, you can tell updatedir() to include an attribute shortname in the resulting hash that is 8.3-compatible. Please note, that updatedir() in this case may be slow and may even fail on large directories, because it will always only try 1000 iterations to find a name that is not yet taken and then give up.


Setting the global variable $SIGNING_KEY makes the generated CHECKSUMS file to be clear-signed by the command specified in $SIGNING_PROGRAM (defaults to gpg --clearsign --default-key ), passing the signing key as an extra argument. The resulting CHECKSUMS file should look like:

    0&&<<''; # this PGP-signed message is also valid perl
    Hash: SHA1

    # CHECKSUMS file written on ... by CPAN::Checksums (v...)
    $cksum = {

    -----END PGP SIGNATURE-----

note that the actual data remains intact, but two extra lines are added to make it legal for both OpenPGP and perl syntax.


If the global variable $MIN_MTIME_CHECKSUMS is set, then updatedir will renew signatures on checksum files that have an older mtime than the given value.


DirHandle, IO::File, Digest::MD5, Digest::SHA, Compress::Bzip2, Compress::Zlib, File::Spec, Data::Dumper, Data::Compare, File::Temp


If updatedir is interrupted, it may leave a temporary file lying around. These files have the File::Temp template CHECKSUMS.XXXX and should be harvested by a cronjob.


Andreas Koenig,; GnuPG support by Autrijus Tang


Copyright (c) 2002-2008 Andreas Koenig, Audrey Tang, Steve Peters.

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



syntax highlighting: