summaryrefslogtreecommitdiff
path: root/macros/generic/memoize/memoize-clean.pl
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-01-03 03:03:02 +0000
committerNorbert Preining <norbert@preining.info>2024-01-03 03:03:02 +0000
commit92effab22b73c432933e7eb8e12c1cefda221df9 (patch)
treecdf3576ee645074d1df994e376d9ca2483c81ec5 /macros/generic/memoize/memoize-clean.pl
parent6b10e9901a24325e837f0fdc2cbce8f43f18ccff (diff)
CTAN sync 202401030303
Diffstat (limited to 'macros/generic/memoize/memoize-clean.pl')
-rwxr-xr-xmacros/generic/memoize/memoize-clean.pl25
1 files changed, 17 insertions, 8 deletions
diff --git a/macros/generic/memoize/memoize-clean.pl b/macros/generic/memoize/memoize-clean.pl
index 4e1334c695..7d7e4f5b43 100755
--- a/macros/generic/memoize/memoize-clean.pl
+++ b/macros/generic/memoize/memoize-clean.pl
@@ -18,18 +18,19 @@
# The files belonging to this work and covered by LPPL are listed in
# <texmf>/doc/generic/memoize/FILES.
+my $PROG = 'memoize-clean.pl';
+my $VERSION = '2024/01/02 v1.1.0';
+
use strict;
use Getopt::Long;
-# I intend to rewrite this script using Path::Class.
use Cwd 'realpath';
use File::Spec;
use File::Basename;
-my $VERSION = '2023/10/10 v1.0.0';
-
-my $usage = "usage: memoize-clean.py [-h] [--yes] [--all] [--quiet] [--prefix PREFIX] [mmz ...]\n";
+my $usage = "usage: $PROG [-h] [--yes] [--all] [--quiet] [--prefix PREFIX] " .
+ "[mmz ...]\n";
my $Help = <<END;
-Remove (stale) memo and extern files.
+Remove (stale) memo and extern files produced by package Memoize.
positional arguments:
mmz .mmz record files
@@ -41,7 +42,8 @@ options:
--all, -a Remove *all* memos and externs.
--quiet, -q
--prefix PREFIX, -p PREFIX
- A path prefix to clean; this option can be specified multiple times.
+ A path prefix to clean;
+ this option can be specified multiple times.
For details, see the man page or the Memoize documentation.
END
@@ -111,8 +113,11 @@ sub populate_tbdeleted {
opendir(MD, $dir) or die "Cannot open directory '$dir'";
while( (my $fn = readdir(MD)) ) {
my $path = File::Spec->catfile(($dir),$fn);
- if ($fn =~ /\Q$basename_prefix\E[0-9A-F]{32}(?:-[0-9A-F]{32})?(?:-[0-9]+)?(\.memo|(?:-[0-9]+)?\.pdf|\.log)/ and ($all || !exists($keep{$path}))) {
- push @tbdeleted, $path;
+ if ($fn =~
+ /\Q$basename_prefix\E[0-9A-F]{32}(?:-[0-9A-F]{32})?(?:-[0-9]+)?#
+ (\.memo|(?:-[0-9]+)?\.pdf|\.log)/x
+ and ($all || !exists($keep{$path}))) {
+ push @tbdeleted, $path;
}
}
closedir(MD);
@@ -161,3 +166,7 @@ if (scalar(@tbdeleted) != 0) {
} elsif (!$quiet) {
print "Nothing to do, the directory seems clean.\n";
}
+
+# Local Variables:
+# after-save-hook: pl2dtx
+# End: