Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: RFC: Tutorial: use strict; now what!?

by educated_foo (Vicar)
on Feb 08, 2012 at 18:02 UTC ( [id://952540]=note: print w/replies, xml ) Need Help??


in reply to Re^3: RFC: Tutorial: use strict; now what!?
in thread RFC: Tutorial: use strict; now what!?

The solution is pretty simple: if your code isn't doing what you expect, run it with "perl -w". This may point to your error (along with a bunch of other non-errors); if it does, you can fix it and move on without having to contort your code to placate warnings.

Replies are listed 'Best First'.
Re^5: RFC: Tutorial: use strict; now what!?
by chromatic (Archbishop) on Feb 08, 2012 at 18:58 UTC
    This may point to your error (along with a bunch of other non-errors);...

    ... and a bunch of warnings in other places that aren't under your control. warnings has a lexical scope, while -w and -W affect the entire process.

      ...and? Let's say you tried to log something undefined, so you passed it to your logging module. With "use warnings", you would see nothing; with "-w", you would get a message. Which do you prefer? (Or, perhaps, which is more "Modern"?)
        Which do you prefer?

        The version which respects encapsulation boundaries, of course.

        With "use warnings", you would see nothing; with "-w", you would get a message.

        Nope; my logging module uses warnings and reports only what's relevant.

Re^5: RFC: Tutorial: use strict; now what!?
by Eliya (Vicar) on Feb 08, 2012 at 18:21 UTC

    Well, "perl -w" is "enabling warnings", too.   I don't specifically care whether people use "use warnings", "-w" on the command line, or "-w" on the shebang line, as long as they do enable warnings when appropriate.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-25 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found