geoffleach has asked for the wisdom of the Perl Monks concerning the following question:
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";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl's caller builtin
by ikegami (Patriarch) on Jul 30, 2011 at 18:24 UTC | |
by geoffleach (Scribe) on Jul 30, 2011 at 22:56 UTC | |
|
Re: Perl's caller builtin
by Corion (Patriarch) on Jul 30, 2011 at 18:24 UTC | |
by geoffleach (Scribe) on Jul 30, 2011 at 22:59 UTC |