| 1 |
NAME |
| 2 |
CPAN::Checksums - Write a "CHECKSUMS" file for a directory as on CPAN |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use CPAN::Checksums qw(updatedir); |
| 6 |
my $success = updatedir($directory, $root); |
| 7 |
|
| 8 |
INCOMPATIBILITY ALERT |
| 9 |
Since version 1.0 the generation of the attribute "shortname" is turned |
| 10 |
off by default. It was too slow and was not used as far as I know, and |
| 11 |
above all, it could fail on large directories. The shortname feature can |
| 12 |
still be turned on by setting the global variable $TRY_SHORTNAME to a |
| 13 |
true value. |
| 14 |
|
| 15 |
DESCRIPTION |
| 16 |
$success = updatedir($dir[, $root]) |
| 17 |
$dir is a directory. Updatedir() writes a "CHECKSUMS" file into that |
| 18 |
directory, unless a previously written "CHECKSUMS" file is there that |
| 19 |
is still valid. Returns 2 if a new "CHECKSUMS" file has been written, |
| 20 |
1 if a valid "CHECKSUMS" file is already there, otherwise dies. |
| 21 |
|
| 22 |
If $root is given, the hash entry with the key "cpan_path" is relative |
| 23 |
to this root directory. |
| 24 |
|
| 25 |
Note: since version 2.0 updatedir on empty directories behaves just |
| 26 |
the same. In older versions it silently did nothing. |
| 27 |
|
| 28 |
Global Variables in package CPAN::Checksums |
| 29 |
$IGNORE_MATCH |
| 30 |
If the global variable $IGNORE_MATCH is set, then all files matching |
| 31 |
this expression will be completely ignored and will not be included |
| 32 |
in the CPAN "CHECKSUMS" files. Per default this variable is set to |
| 33 |
|
| 34 |
qr{(?i-xsm:readme$)} |
| 35 |
|
| 36 |
$CAUTION |
| 37 |
Setting the global variable $CAUTION causes updatedir() to report |
| 38 |
changes of files in the attributes "size", "mtime", "md5", or |
| 39 |
"md5-ungz" to STDERR. |
| 40 |
|
| 41 |
$TRY_SHORTNAME |
| 42 |
By setting the global variable $TRY_SHORTNAME to a true value, you |
| 43 |
can tell updatedir() to include an attribute "shortname" in the |
| 44 |
resulting hash that is 8.3-compatible. Please note, that updatedir() |
| 45 |
in this case may be slow and may even fail on large directories, |
| 46 |
because it will always only try 1000 iterations to find a name that |
| 47 |
is not yet taken and then give up. |
| 48 |
|
| 49 |
$SIGNING_KEY |
| 50 |
Setting the global variable $SIGNING_KEY makes the generated |
| 51 |
"CHECKSUMS" file to be clear-signed by the command specified in |
| 52 |
$SIGNING_PROGRAM (defaults to "gpg --clearsign --default-key "), |
| 53 |
passing the signing key as an extra argument. The resulting |
| 54 |
"CHECKSUMS" file should look like: |
| 55 |
|
| 56 |
0&&<<''; # this PGP-signed message is also valid perl |
| 57 |
-----BEGIN PGP SIGNED MESSAGE----- |
| 58 |
Hash: SHA1 |
| 59 |
|
| 60 |
# CHECKSUMS file written on ... by CPAN::Checksums (v...) |
| 61 |
$cksum = { |
| 62 |
... |
| 63 |
}; |
| 64 |
|
| 65 |
__END__ |
| 66 |
-----BEGIN PGP SIGNATURE----- |
| 67 |
... |
| 68 |
-----END PGP SIGNATURE----- |
| 69 |
|
| 70 |
note that the actual data remains intact, but two extra lines are |
| 71 |
added to make it legal for both OpenPGP and perl syntax. |
| 72 |
|
| 73 |
$MIN_MTIME_CHECKSUMS |
| 74 |
If the global variable $MIN_MTIME_CHECKSUMS is set, then updatedir |
| 75 |
will renew signatures on checksum files that have an older mtime |
| 76 |
than the given value. |
| 77 |
|
| 78 |
PREREQUISITES |
| 79 |
DirHandle, IO::File, Digest::MD5, Digest::SHA, Compress::Bzip2, |
| 80 |
Compress::Zlib, File::Spec, Data::Dumper, Data::Compare, File::Temp |
| 81 |
|
| 82 |
BUGS |
| 83 |
If updatedir is interrupted, it may leave a temporary file lying around. |
| 84 |
These files have the File::Temp template "CHECKSUMS.XXXX" and should be |
| 85 |
harvested by a cronjob. |
| 86 |
|
| 87 |
AUTHOR |
| 88 |
Andreas Koenig, [email protected]; GnuPG support by Autrijus Tang |
| 89 |
|
| 90 |
COPYRIGHT & LICENSE |
| 91 |
Copyright (c) 2002-2008 Andreas Koenig, Audrey Tang, Steve Peters. |
| 92 |
|
| 93 |
This program is free software; you can redistribute it and/or modify it |
| 94 |
under the same terms as Perl itself. |
| 95 |
|
| 96 |
SEE ALSO |
| 97 |
perl(1). |
| 98 |
|