Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by Dog and Pony (Priest)
on May 02, 2002 at 23:15 UTC ( [id://163687]=note: print w/replies, xml ) Need Help??


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

That is true, as I am aware of (see my no-pun remark above). I still put them there, to a) mark the end of a package in an easily readable way (yes, I want that in addition to a new package declaration), and b) so I won't forget it if I decide to move it to a separate file. Cargo Cult or no, I see no error in that practice, at least not for those reasons?

But it is ok to point that difference out, of course.


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

Replies are listed 'Best First'.
Re: Re: Re: Re: How to end a Perl script
by samtregar (Abbot) on May 02, 2002 at 23:19 UTC
    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

      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://163687]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-25 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found