O Monks, enlighten your humble seeker of knowledge.

The Getopt::Auto module has a help feature that generates a help message based on the options that have been defined in the POD. The generated help message includes the program's path.

In testing this feature, I generate a help message and compare it to that generated by Getopt::Auto. The module gets its path from Perl's caller builtin - caller, the call takes place in the import phase.

This works fine on Unix-based platforms. However on Windows Vista (MSWin32), the path generated with File::Spec->catfile() uses backslashes, while caller appears to use the Unix-standard forward slash. (Tested on Perl 14)

Specifically, the test output for test 02-internals_magic.t is

t/02-internals_magic.t # generated by caller() ^ not t\02-internals_magic.t # generated by File::Spec->catfile() ^ as expected

Is this the way that caller works?

I'd appreciate receiving the MSWin32 output from following code. Note that it must be run from at least one directory level away from the source.

print "$0 running in Perl $^V\n"; foo::t(); package foo; sub t { @c = caller; print "Caller[1] is: $c[1]\n";}

In reply to Perl's caller builtin by geoffleach

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.