The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'll offer another linguistic interpretation for you and call this heuristically ambiguous object syntax (in addition to Perldoc's own references to indirect as well.) The reason for this is spelled out in the perlobj documentation, which recommends the so-called indirect object syntax be avoided. Consider the code below, which provides both a new and connect constructor. The instantiation of $obj4 breaks because connect is also a built-in command, and Perl's heuristics prefer it over the connect constructor of the Example class. The same is true for the popular DBI->connect() constructor, as well as many other real-world examples you find in the wild. It's best not to let something as muddy as heuristics determine what your code does, so I personally avoid such constructs with a passion. Leave that stuff to Java where it belongs ;).
In reply to Re: "Indirect" object syntax?
by Apero
|
|