Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Handling braces with methods without arguments

by rjt (Deacon)
on Sep 17, 2012 at 11:33 UTC ( #994016=note: print w/ replies, xml ) Need Help??


in reply to Handling braces with methods without arguments

As others before me have mentioned, all three options are valid syntax, but you probably already knew that. So, it comes down to matters of style. Where style is concerned, perlstyle is the go-to document.

perlstyle doesn't specify this case. However, a couple of quotes hint that parenthesis might be slightly preferred:

Function and method names seem to work best as all lowercase. E.g., $obj->as_string() .

This example uses parens.

Note that function names are considered more readable with parentheses after their name, that is function() .

This quote comes from the Pod doc section, where functions are referred to in English (or whatever) text, so it doesn't exactly refer to the code itself.

The bottom line, the golden rule with any stylistic choice, is be consistent. If you (or someone else) starts coding with or without parenthesis, keep doing it.


Comment on Re: Handling braces with methods without arguments
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2014-07-29 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls