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...


In reply to making 'use strict' default conflicts with CORE modules/scripts by LanX

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.