logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: [Module::Build] Return $self: msg#00148

Subject: Re: [Module::Build] Return $self
On Dec 23, 2004, at 10:06 AM, Chris Dolan wrote:

Personally, I prefer chained methods. However, the major flaw is that they must always return $self, or else you get the "Can't call method "foo" on an undefined value" fatal error. This means that once MB methods are advertised as chained, they can't ever be switched to returning anything but $self without breaking compatibility and causing older MB scripts to die() with the above error.

If M::B throws exceptions, then there's no reason not to always return $self.

This is just as problematic as chained methods. If we advocate this syntax, then we must ensure that new() never returns undef, or there will be script crashes out there.

Good point.

Regards,

David



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/


<Prev in Thread] Current Thread [Next in Thread>