Re: utils/perldoc.Com vs utils/perldoc
"Craig A. Berry" <[email protected]> Sat, 21 Sep 2013 17:32:45 -0500
| Newsgroups | gmane.comp.lang.perl.ports.vms |
|---|---|
| Message-ID | <[email protected]> |
On Sep 21, 2013, at 1:33 PM, "John E. Malmberg" = <[email protected]> wrote: >=20 > The wrapper that simulates the shebang only runs it in a way that = produces an error message. I can not find any way to run it that takes = advantage of the wrapper and results in useful output. >=20 > All attempts to run perldoc.com as a command instead of as a perl = script that I can find just result in it emitting an error message. OK. I think I see where we are talking at cross purposes. I was = talking exclusively about how the shebang emulation works in the general = case by having $Config{startperl} prepended to the .com file. I assumed = that perldoc.com would work just the same as any other comparable = utility in this respect, but it doesn't. Bad assumption on my part. = Sorry about that. I think you might have been assuming the same thing in reverse, namely = that if perldoc.com has a problem, there must be a more general problem = with the shebang emulation. But I don't think there is. The following illustrations that the shebang emulation works just fine = in the general case: $ type testshebang.com $ perl 'f$env("procedure")' "''p1'" "''p2'" "''p3'" "''p4'" "''p5'" = "''p6'" "''p7'" "''p8'"! $ exit++ + ++$status!=3D0 and $exit=3D$status=3Dundef; while($#ARGV !=3D = -1 and $ARGV[$#ARGV] eq ''){pop @ARGV;} eval 'exec perl_root:[000000]Perl.exe -S $0 ${1+"$@"}' if 0; require 5; print "hello\n"; $ define DCL$PATH SYS$DISK:[] %DCL-I-SUPERSEDE, previous value of DCL$PATH has been superseded $ testshebang hello But perldoc.com doesn't work that way, as you discovered, and it's = because it's a pretty thin wrapper around Pod::Perldoc::run. So there = is a bug in Pod::Perldoc (specifically Pod::Perldoc::program_name) which = makes invalid and non-portable assumptions about the name of the file = it's running. As far as I can see from a quick look, the only real = problem is that it doesn't know what to do with the version number, = i.e., "perldoc.com;1" is unacceptable, whereas "perldoc.com" would be = ok. I have no time for (and not much interest in) pursuing this further, but = most likely replacing the line in Perldoc.pm that looks like: (?: \. (?: bat | exe | com ) )? # possible extension with (?: \. (?: bat | exe | com | com;\d+ ) )? # possible extension would do the trick. And version numbers on .exe files are also possible = of course. So folks interested in this bug might want to report/fix it = at <https://rt.cpan.org/Public/Dist/Display.html?Name=3DPod-Perldoc>. ________________________________________ Craig A. Berry mailto:[email protected] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser