Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: use strict without typing use strict?

by LanX (Saint)
on May 26, 2021 at 09:15 UTC ( [id://11133045]=note: print w/replies, xml ) Need Help??


in reply to Re: use strict without typing use strict?
in thread use strict without typing use strict?

Well in theory he could set the environment with PERL5OPT=-Mstrict or manipulate sitecustomize.pl (see perlrun for details) ...

D:\tmp>set PERL5OPT=-Mstrict D:\tmp>perl -ce "$fred = 42" Global symbol "$fred" requires explicit package name (did you forget t +o declare "my $fred"?) at -e line 1. -e had compilation errors.

... but I would hate the side effect of random errors, if the script was accidentally run in another environment and strict was missing.

The safest would be to alias/link perl to a new name like superl - the "super language" ;) - which auto-defaults to strict.

Like this superl script.pl would simply not run if the workaround was missing.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

PS: On a side-note: The whole Perl7 mess could be solved like this too! (The language needs a rebranding anyway to overcome the mobbing. Don't shoot the messenger...:)

Replies are listed 'Best First'.
Re^3: use strict without typing use strict?
by eyepopslikeamosquito (Archbishop) on May 26, 2021 at 09:35 UTC

    Good catch. Totally forgot about PERL5OPT. :)

    Just in case this is an XY Problem, I'd be interested to learn the underlying real reason why the OP wants to do this. Just for personal convenience? Or is there an organisational back story, perhaps trying to control what others do?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133045]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2024-04-18 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found