in reply to Re: chaining method calls (smart error object)
in thread chaining method calls
I like your idea, enough even to have a bash at it myself, moreso for
educational purposes than anything. The first thing that struck me thought
was "How can AUTOLOAD determine boolean context?". I know that wantarray
will define whether the calling context is list, scalar or void. However I am stumped
when it comes to determining boolean context.
If I have you right.., and Some::Package returns error objects on failure.
Presuming the new method fails, returning an error object (populated with some meaningful message),
then the call to connect will be caught by the error object's AUTOLOAD. At this point we determine context, and
depending on that confess.
my $obj = Some::Package->new( %params );
Is there nothing already out-there to do this? I'm off to CPAN first. ++tye
I can't believe it's not psellchecked