Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re: Re: How to end a Perl script

by samtregar (Abbot)
on May 02, 2002 at 23:19 UTC ( [id://163689]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: How to end a Perl script
in thread How to end a Perl script

Cargo Cult practices are very rarely "wrong" in the sense of causing bad results. More often they are, like this one, just plain unnecessary. Instead of a cryptic "1;" you could write "# end of package Foo::Bar." And if you're worried about forgetting the "1;" when you move the package to a new file, well, don't. Perl will be happy to remind you when you try to load the new file!

-sam

Replies are listed 'Best First'.
Re(5): How to end a Perl script
by Dog and Pony (Priest) on May 03, 2002 at 07:50 UTC
    Sorry to keep this going, but I do not see what the win would be by doing it your way. Maybe it fulfills some way of doing it that some guru has claimed is the best (yes, I remember the debate over Cargo Cult programming). I don't say it is bad doing it your way, I don't see what the big deal is actually.

    Using "1;" is as readable as a comment to me and most others - actually, you could think of it as one if you wish? Or is comments just plain unnecessary too (I mean, perl will run without them)? Sorry about that sarcasm, but it really looks like "Cargo Cult" is used as a buzzword this time (again).

    Again, sorry to keep the discussion alive like this.


    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.
      Using "1;" is as readable as a comment to me and most others

      Why bother using 1? I mean the requirement is only that whatever is used evaluates as true, thus much more interesting and entertaining are possible. From Carp::Assert by Schwern

      return q|You don't just EAT the largest turnip in the world!|;
      From Tie::Cycle and Tie::FlipFlop by abigail
      "Tie::Cycle"; "End of Tie::FlipFlop";
      And I'm sure there are lots more examples... :-)

      As to samtregar I have to say that your use of Cargo Cult in this context wasn't well thought through. Thats like saying that putting in a trailing comma in your arguments lists or hash declarations or using a semicolon on the last statement of a block or any of the other unecessary things that perl allows you to do in the interest of minimizing errors in the long term are Cargo Cult programming. And I just cant see you arguing that point :-)

      Yves / DeMerphq
      ---
      Writing a good benchmark isnt as easy as it might look.
      <super>Edited: removed unintentionally confrontational wording.</super>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-03-28 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found