CPAN::Checksums(3pm)
π CPAN::Checksums β bestie edition π
okay so bestie, this is CPAN::Checksums, a Perl module that writes a CHECKSUMS file for a directory, exactly like the ones on CPAN. queen behavior honestly π
β¨ SYNOPSIS β¨
use CPAN::Checksums qw(updatedir);
my $success = updatedir($directory, $root);
that's it. that's the whole vibe check. π
π¨ INCOMPATIBILITY ALERT π¨
not me having to deliver bad news π since version 1.0, the generation of the attribute shortname is turned off by default. why? because it was too slow, and as far as the author knows nobody even used it, and on top of all that it could straight up fail on large directories π
but bestie, it's not gone forever!! you can still turn the shortname feature back on by setting the global variable $TRY_SHORTNAME to a true value. she's still there if you want her π«Ά
πΈ DESCRIPTION πΈ
$success = updatedir($dir[, $root])
so $dir is a directory, right? and updatedir() writes a CHECKSUMS file into that directory β unless a previously written CHECKSUMS file is already sitting there and is still valid, in which case she just chills. β¨
here's the return value tea:
- returns
2if a brand newCHECKSUMSfile has been written π - returns
1if a validCHECKSUMSfile is already there π - otherwise dies π
if $root is given, then the hash entry with the key cpan_path is relative to this root directory.
note: since version 2.0, updatedir on empty directories behaves just the same. in older versions it silently did nothing. so if you were relying on the old silenceβ¦ nope, not anymore bestie π
π¦ Global Variables in package CPAN::Checksums π¦
$IGNORE_MATCHβ if the global variable$IGNORE_MATCHis set, then all files matching this expression will be completely ignored and will not be included in the CPANCHECKSUMSfiles. per default this variable is set to
qr{(?i-xsm:readme$)}
$CAUTIONβ setting the global variable$CAUTIONcausesupdatedir()to report changes of files in the attributes"size","mtime","md5", or"md5-ungz"toSTDERR. like she's snitching but in a helpful way π$TRY_SHORTNAMEβ by setting the global variable$TRY_SHORTNAMEto a true value, you can tellupdatedir()to include an attribute"shortname"in the resulting hash that is 8.3-compatible. but please note, thatupdatedir()in this case may be slow and may even fail on large directories, because it will always only try1000iterations to find a name that is not yet taken and then give up. she's trying her best okay π one thousand attempts and then she's done, periodt.$SIGNING_KEYβ setting the global variable$SIGNING_KEYmakes the generatedCHECKSUMSfile to be clear-signed by the command specified in$SIGNING_PROGRAM(defaults togpg --clearsign --default-key), passing the signing key as an extra argument. the resultingCHECKSUMSfile should look like:
0&&<<''; # this PGP-signed message is also valid perl
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
# CHECKSUMS file written on ... by CPAN::Checksums (v...)
$cksum = {
...
};
__END__
-----BEGIN PGP SIGNATURE-----
...
-----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. dual citizenship, iconic π
$MIN_MTIME_CHECKSUMSβ if the global variable$MIN_MTIME_CHECKSUMSis set, thenupdatedirwill renew signatures on checksum files that have an oldermtimethan the given value. out with the old, in with the new β¨
π PREREQUISITES π
the girlies she needs to function: DirHandle, IO::File, Digest::MD5, Digest::SHA, Compress::Bzip2, Compress::Zlib, File::Spec, Data::Dumper, Data::Compare, File::Temp
a whole squad fr fr π«Ά
π BUGS π
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. so likeβ¦ she's messy, sorry, set up a cronjob to clean up after her π§Ή
π AUTHOR π
Andreas Koenig, andreas.koenig@anima.de; GnuPG support by Autrijus Tang
π COPYRIGHT & LICENSE π
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.
π SEE ALSO π
and that's the whole page bestie!! this was lifted from the CPAN::Checksums(3pm) page β User Contributed Perl Documentation, no cap, and it's perl v5.38.2 dated 2024-01-21. go write some CHECKSUMS files and slay πβ¨ππ¦
π¦ where this page comes from
- debian trixie: libcpan-checksums-perl 2.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcpan-checksums-perl 2.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcpan-checksums-perl 2.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcpan-checksums-perl 2.14-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms