Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Re^2: There's a level in Hell reserved for ________

by jdporter (Canon)
on Mar 11, 2003 at 20:03 UTC ( #242135=note: print w/ replies, xml ) Need Help??


in reply to Re: Re^2: There's a level in Hell reserved for ________
in thread There's a level in Hell reserved for ________

the generally accepted style for Perl??? I think not! Sure, it's a meme that gets around. But it's sucky, and needs to be squashed by anyone and everyone who thinks about it consciously. Put simply, there is no reason to do it that way, and there are good reasons not to do it that way.

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.


Comment on Re: Re: Re^2: There's a level in Hell reserved for ________
Re: Re: Re: Re^2: There's a level in Hell reserved for ________
by perrin (Chancellor) on Mar 11, 2003 at 20:11 UTC
    I've always used this style for args:
    my_function_call( $arg1, $arg2, $arg3, );
    And for really long ones that would wrap, I do something like this:
    My::Module::With::Really::Long::Name::and_function_call( $arg1, $arg2, $arg3, );
    Keeping each arg on a separate line makes them easy to read and easy to change, in my opinion. It is the most common style I've seen in use by experienced Perl programmers.
      I always write them like so:
      my_function_call( $arg1, $arg2, $arg3, );
      I indent all blocks, whether they be code, anonymous array/hash constructors, parameter (or other) lists, or anything else in the same way. Makes a lot of sense, if you ask me, when you're nesting calls:
      my_function_call( my_other_function_call( $arg1, $arg2, and_yet_one_more_function_call( $arg1, $arg2, $arg3, ), ), $arg2, $arg3, );
      Compare:
      my_function_call( my_other_function_call( $arg1, $arg2, and_yet_one_more_function_call +( + $arg1, + $arg2, + $arg3, +), ), $arg2, $arg3, );
      Yuck, if I may say so.

      Makeshifts last the longest.

      I do as Aristotle does. That way if I have to change the line on which the function call is made, I don't have to reindent the arguments.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-12-26 05:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls