Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

-w and -T

by Anonymous Monk
on Mar 18, 2009 at 11:59 UTC ( [id://751422]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

what's the purpose of -w.strict,-T?

Replies are listed 'Best First'.
Re: -w and -T
by Bloodnok (Vicar) on Mar 18, 2009 at 12:01 UTC
Re: -w and -T
by manoj_speed (Prior) on Mar 18, 2009 at 12:06 UTC

    -w option enables warning.

    use strict pragma is used then you should declare variables before there use.

    -T is taint mode. Taint mode makes a program more secure by keeping track of arguments which are passed from external source.

Re: -w and -T
by vinoth.ree (Monsignor) on Mar 18, 2009 at 12:38 UTC
Re: -w and -T
by sundialsvc4 (Abbot) on Mar 18, 2009 at 16:54 UTC

    As you'll see from the referred-to documents, strict and warnings are (IMHO, very essential, “don’t leave home without them”) directives that tell Perl to assume that you've made a mistake... and to very rigorously point out cases where you (probably) have done so.

    “Taint mode” is a very clever feature that you just don't find in too many languages. Basically, it instructs Perl to pay attention to where a particular (input) value comes from. You're assuming that anything you get directly from the user “must be something that's been cleverly-engineered by this nefarious person expressly for the purpose of blowing-up my precious application by slipping through its defenses.” (Which is actually a pretty good assumption.) “Taint mode” causes Perl itself to help you detect any situation where a value that has been directly input from the user has not yet been “sanitized” by your code. It is quite thorough, even to the point of being annoyingly thorough.   :-D

    At this point, you definitely want to learn about use warnings and use strict (which do the same thing as the command-line switches you mentioned, only “all the time”). You can possibly put-off learning about taint mode for a little while, but you should put use strict; use warnings; at the top of every single thing that you write from this day forward.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (None)
    As of 2024-04-25 00:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found