Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Silly Roommate Tricks

by wombat (Curate)
on May 26, 2001 at 11:06 UTC ( #83481=perlmeditation: print w/ replies, xml ) Need Help??

Okay. I'll actually post something after this long while. My post counter has been at 42 for some time now. It's time to move on. So recently my roommate and I have been having our usual wars over Vi and the virtues of Perl. Today however, I have trumped him, and my Perl knowledge outshines his.

I have started heading my codes with "require strict;" as a joke. The first time he saw this he bugged out. "DUDE!" he said "Require strict! You don't require strict, you use strict! Require strict is sick and twisted and massochistic!" I pointed out how he was forcing me to use mail by not installing pine on his BSD box (which became our main server after we got h4x0r3d), and how he was forcing me to have a massochistic shell among other things. I said that I would willingly take on this extra bit of pain!

He beleives, I think, that require is more forceful than use. I looked it up in the Camel book because he could never explain himself better than "It's just wrong!" and "Dude! That's just SICK!" (Much like the other roommate criticizes Republicans. We'd debate her if she could be debated with...) Require merely checks to see if a package or module is there, but does not actually import it. (For those who don't know) Therefore you can say "require strict;" at the top of your code, and then still use the sloppy regular code conventions. Not that I do that of course, I have to keep appearances up...

Anyway, the only reason I am telling you this, is that he challenged me to post this tale here, and "watch your XP drop like a rock". I say unto you! I grok the differences between require and use! :-)

Anyway. I hope you're as amused as I am.

~W

Comment on Silly Roommate Tricks
Re (tilly) 1: Silly Roommate Tricks
by tilly (Archbishop) on May 26, 2001 at 20:45 UTC
    Did you actually try running a test of what happens if you require strict and then try to do something that strict will block?

    You will find that the declaration is utterly useless.

    The reason is that all of the magic of strict is buried in what the import method of strict does to the parsing of your code at compile time. A simple require loads strict too late (ie at runtime) and does not call the import method.

    See Re (tilly) 1: How does strict work? for a longer explanation of how exactly strict works.

    Oh, and let this be a lesson. As one Alexander Pope said:

    A little learning is a dangerous thing;
    Drink deep, or taste not the Pierian spring:
    There shallow draughts intoxicate the brain,
    And drinking largely sobers us again.
    But as Aldous Huxley observed:
    If a little knowledge is dangerous, where is the man who has so much as to be out of danger?
    Certainly I don't! Which is why before I told you that what you were doing was useless I ran the following test of knowledge I imagine I have:
    perl -e 'require strict; print $foo = "Hello\n"'
    And only armed with this verification did I write this post...
      I think wombat understands completely that "require strict" is useless. After all, he says, "Therefore you can say 'require strict;' at the top of your code, and then still use the sloppy regular code conventions". I.e., it is useless -- it doesn't prevent sloppy variables, it doesn't hit you up for barewords, etc. It's just a "Silly Roommate Trick".

      wombat's point, it seems, is that while useless, "require strict;" is not "masochistic".

        wombat's point, it seems, is that while useless, "require strict;" is not "masochistic".

        No, it is "sadistic". Something to torture your roomate with :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://83481]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2014-07-30 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (236 votes), past polls