Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Want END block to run except when usage()/--help invocation

by Happy-the-monk (Canon)
on Feb 27, 2015 at 07:44 UTC ( #1118057=note: print w/replies, xml ) Need Help??


in reply to Re^2: Want END block to run except when usage()/--help invocation
in thread Want END block to run except when usage()/--help invocation

Is there a way to dynamically disable 'use strict' and/or 'use warnings' at run-time?

Do not use the -w switch then, use warnings instead: # <- edited, see BrowserUK's correct comment below.

use strict; use warnings; # ... no strict; no warnings 'uninitialized'; # only specific warnings switched off. # un-refined code use warnings 'uninitialized'; # escape to safety use strict;

You don't need to switch off strict for the case in question, though.

Cheers, Sören

Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)

Replies are listed 'Best First'.
Re^4: Want END block to run except when usage()/--help invocation
by BrowserUk (Pope) on Feb 27, 2015 at 09:31 UTC
    Do not use the -w switch then,

    No warnings work just as well with -w:

    C:\test>perl -wE"my $x; say $x; { no warnings 'uninitialized'; say $x +}" Use of uninitialized value $x in say at -e line 1.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1118057]
help
Chatterbox?
[Corion]: A pleasant daypart to everybody!

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2018-05-23 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?