Next | Tricks of the Wizards | 121 |
We've already seen
... require Carp; Carp::croak(...); ...
as a way to defer loading of a module until it's needed.
Alternative: use AUTOLOAD
sub AUTOLOAD { if ($AUTOLOAD =~ /::croak$/) { require Carp; goto &Carp::croak; } }
Next | Copyright © 2003 M. J. Dominus |