|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re: multiple method calls against the same object, revisitedby simonm (Vicar) |
| on Dec 27, 2004 at 19:46 UTC ( #417616=note: print w/ replies, xml ) | Need Help?? |
|
For what it's worth, I think I prefer this syntax:
Implementation follows:
P.S.: Unfortunately, if( $@ ) { require Carp; Carp::croak( $@ ) } won't work the way you want it to, because if Carp hasn't already been required, the process of loading it clears $@, so it's not available to the croak call. You could write it as if ( my $err = $@ ) { ... croak( $err) } but I think that in practice this technique will only be used in larger, non-trivial applications, so you might as well just require Carp up front.
In Section
Snippets Section
|
|