NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Other Languages (Score:1)
Maybe they are taking other languages into consideration. For example, to someone with a PHP background, this looks like a property:
my $foo = $obj->bar;
This looks like a method:
my $foo = $obj->bar();
I think the parentheses universally indicate a function or method, so that might be what they mean by clarity.
Re:Other Languages (Score:2)
Re:Other Languages (Score:1)
I'll see your PHP to Perl migration strategy and raise you a Perl to PHP migration strategy:
http://search.cpan.org/dist/PHP-Interpreter/ [cpan.org]
:-)
just easier to read (Score:1)
Re:just easier to read (Score:2)
Re:just easier to read (Score:1)
my $val = Foo->new->{attribute}->format->{id};
It can get confusing quickly, especially when people do that horrible "return yourself" method chaining that SOAP-Lite uses. I know I'm in the minority on this though. I just don't think there's any advantage to leaving them off, and it makes your code less consistent.
What about :lvalue? (Score:1)
A sub is a property is a sub. What about when using the :lvalue attributes; as evil as they are?
Would you put the parens here:
but not here:
or leave it
Re:What about :lvalue? (Score:2)
-Dom
Re:What about :lvalue? (Score:1)
However, I have seen 3rd party modules that use it internally, so calling those 3rd party functions will fall under the formatting policy above.
Re: (Score:1)
The only rationale for consistent guidelines is... (Score:2)
In this case, that may make the code more greppable. So you don't have "->foobar" results when you grep for "->foo" for example. (Note that I and my shop both disagree with this particular guideline :)
One of the nice things about -method()... (Score:1)
Oh wait, I'm dreaming about the PPI automanipulatification of Perl::Style (or perhaps you'd call it Perl::MyWay)...
In any case I REALLY need to get around to getting that written.