A snippet from IOC::Lite follows:
sub AUTOLOAD{ my($self, @args) = @_; my @method_and_structure = split m|\:\:|, $AUTOLOAD; my $method = $method_and_structure[@method_and_structure-1]; if ($self->{object}->can($method)){ return $self->{object}->$method(@args); } die ">$method is not found on " . $self->get_type() . "\n"; }
I've taken the concept a little further, almost AOP like, in the version of IOC::Lite I'm working on now. That way I can add all types of features to objects the container doesn't own. The basic component management methods will be first, followed closely by dynamic logging. Not sure where I'll head from there.
Sorry if this is just rambling. Bottom line: I think it would be quite useful on large software projects. I can't tell you how many times I wished I had this feature when coding in (C/C++/Java/etc)
John
janitored by ybiC: Replace frowned-upon <pre> tags with Monastery-standard <code> tags
In reply to Re: AUTOLOAD - the good, the bad, and the ugly
by raptnor2
in thread AUTOLOAD - the good, the bad, and the ugly
by shemp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |