in reply to Using the perl debugger to look at a renaming files function
The Perl debugger is a wonderful tool, and I use it quite often - whenever I find it is the appropriate tool for the task. Before I fire up the debugger, I always stare at the messages, the code and at the docs, and in your example this turns out to be sufficient to see what's happening. In your case, the messages you get are quite helpful, and the debugger is unlikely to get more:
You seem to be wondering about the warning Subroutine debug1::getcwd redefined...?
Line 397 has to be the most innocent looking thing I've ever seen:use Cwd;
According to the docs, Cwd exports a function 'getcwd'. If this is a redefinition, then look for another module which exports a function with the same name. Here's a sample utils1.pm (you didn't include this) which is sufficent to cause that message to appear:
# A sample utils1.pm use Path::Tiny 'cwd'; 1;
Next, the code terminates with the message:
Can't use an undefined value as a HASH reference at template_stuff/debug1.pm line 35.
That's also quite obvious: You're calling the sub without any parameters, but it expects one which can be used as a HASH reference in line 35 of debug1.pm:
my $rvars = shift; my %vars = %$rvars;
Unfortunately, I just don't understand your Q1 and can't help you there:
, do I have a canonical way to decide what alphanumeric order is in a world teemimg with things that could be filenames and what might be competing ways to decide precedence?
But anyway:
I'm left wondering how many types of weird filenames out there might confound a script, too.
None, if your script reads a directory like it should (either using Path::Tiny or opendir/readdir), and if you don't make wrong assumptions about which characters can appear in a path.
Finally, some general advice if you want to get good answers here:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Using the perl debugger to look at a renaming files function (introspection)
by LanX (Saint) on Feb 04, 2021 at 20:08 UTC | |
Re^2: Using the perl debugger to look at a renaming files function
by Aldebaran (Curate) on Feb 05, 2021 at 08:50 UTC | |
by hippo (Archbishop) on Feb 05, 2021 at 09:45 UTC | |
by haj (Vicar) on Feb 06, 2021 at 13:00 UTC |