http://qs321.pair.com?node_id=1110202

LanX has asked for the wisdom of the Perl Monks concerning the following question:

A perlmongers friend of mine asked me how to avoid boilerplate when typing snippets interactively on the console...

(... also bitching around that Modern::Perl isn't CORE and that there are no packages to install it, neither for Debian nor Win...)

So I suggested to just configure PERL5OPT export PERL5OPT='-Mstrict' and so on for his other default stuff.

Problem now is that perldoc (!!!) fails in that environment ... and I suppose there are more core-modules with similar problems (jeeeez ... o.O )

lanx@lanx-1005HA:~$ export PERL5OPT="-Mstrict" lanx@lanx-1005HA:~$ perldoc perldoc Global symbol "$running_under_some_shell" requires explicit package na +me at /usr/bin/pod2man line 6. BEGIN not safe after errors--compilation aborted at /usr/bin/pod2man l +ine 18. Got a 0-length file from /usr/share/perl/5.14/pod/perldoc.pod via Pod: +:Perldoc::ToMan!?

ok this could be solved with an extension to Modern::Perl checking for an exception list of old "unstrict" modules in the caller and including this extended modern module into PERL5OPT.

After all this is only meant for the console....

Anyway I started to investigate /usr/bin/pod2man to isolate the problem and found the following code:

#!/usr/bin/perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # pod2man -- Convert POD data to formatted *roff input. # # Copyright 1999, 2000, 2001, 2004, 2006, 2008, 2010 # Russ Allbery <rra@stanford.edu> # # This program is free software; you may redistribute it and/or modify + it # under the same terms as Perl itself. require 5.004; use Getopt::Long qw(GetOptions); use Pod::Man (); use Pod::Usage qw(pod2usage); use strict; # ...

so all of this comes from dual code to allow the script to be run under perl and *sh equally.

I'm puzzled, any good idea how to "strictify" this?

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

update

not sure how pod2man is called but if $running_under_some_shell is a perl variable, it should be sufficient to fully qualify it like with $main::running_under_some_shell but I suppose it's rather a shell var...