summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/memoize/memoize-clean.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/memoize/memoize-clean.pl')
-rwxr-xr-xMaster/texmf-dist/scripts/memoize/memoize-clean.pl25
1 files changed, 17 insertions, 8 deletions
diff --git a/Master/texmf-dist/scripts/memoize/memoize-clean.pl b/Master/texmf-dist/scripts/memoize/memoize-clean.pl
index 4e1334c6958..7d7e4f5b433 100755
--- a/Master/texmf-dist/scripts/memoize/memoize-clean.pl
+++ b/Master/texmf-dist/scripts/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: