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

Re: Re^3: Things every perl programmer should know? (disabled warnings)

by Juerd (Abbot)
on Jun 04, 2003 at 23:31 UTC ( #263181=note: print w/replies, xml ) Need Help??

in reply to Re^3: Things every perl programmer should know? (disabled warnings)
in thread Things every perl programmer should know?

no warnings 'once'; because that sodding warning has never caught anything for me that strict wouldn't have trapped sooner. The kicker is that fixing it requires jumping through very silly hoops to make it go away.

I find that error message very useful. It's not just catching spelling errors, which strict does indeed do better, but it's also catching variables that you really did use once. Variables used once are useless.

If you have a variable that is used only once, then why use that variable? You're throwing away its value if it has one, and there's a variable declared that you don't use. "Variable used only once" actually means "Hey, you forgot to remove a line during your lastmost recent refactoring" or at least "You're throwing away valuable resources". :)

Juerd # { site => '', plp_site => '', do_not_use => 'spamtrap' }

  • Comment on Re: Re^3: Things every perl programmer should know? (disabled warnings)

Replies are listed 'Best First'.
Re^5: Things every perl programmer should know? (disabled warnings)
by Aristotle (Chancellor) on Jun 04, 2003 at 23:39 UTC

    That would be helpful, except the warning only catches package variables, which I often very well intend to set only once (usually another module's option variables, stuff like $CGI::POST_MAX). The amount of package variables used in my code is very nearly zero anyway, and I scope my lexicals as tightly as possible (I don't reuse temporary variables either) so leftovers are a pretty much a non-issue.

    In summary, all that warning has ever managed to do for me is to cause mild to immense irritation, without any benefit whatsoever.

    Makeshifts last the longest.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://263181]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2018-01-20 06:30 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (226 votes). Check out past polls.