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