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