Hello Aldebaran,

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:


In reply to Re: Using the perl debugger to look at a renaming files function by haj
in thread Using the perl debugger to look at a renaming files function by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.