Can someone point me at docs as to why that's better? I've seen both used and didn't know one was considered better than the other.

new CGI; is ambiguouse (did you mean to call the function new() in the main:: name space with the expression (function? constant? bareword? handle?) "CGI"?

CGI->new() is clearly a method call to CGI's new() method.

in this case it may be pretty obvious *but* an object construtor method does not have to be named "new" and in such a case:


birdhouse SOUL {
    'size'  => 'little',
    'whose' => 'your',
};

is much more difficult to tell whats going on than:

SOUL->birdhouse({
    'size'  => 'little',
    'whose' => 'your',
});

Its immediately obviouse without any muss or fuss that its a call to "make a little birdhouse in your soul" :)

Its documented in `perldoc perlstyle` I beleive (no time to check right now) and also see Damian Conway's "Perl Best Practices" if you really want to start doing stuff right ;p

HTH :)

Reply via email to