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