One place where I've seen this technique is a ORM package on CPAN - Class::Tables - which auto-generates classes from table names and makes colum names into their methods using AUTOLOAD:
sub AUTOLOAD { my $self = shift; (my $func = $Class::Tables::AUTOLOAD) =~ s/.*:://; croak qq{Can't locate object method "$func" via package "$self"} unless ref $self and UNIVERSAL::isa( $self, "Class::Tables" ); unshift @_, $self, $func; goto &field; }
The field() sub translates its arguments to the appropriate SQL call against the database. I've used that package very much, and I have seen no adverse side effects. And no, I'm not aware of a cleaner way to do this.
I'm still puzzled by the meaning of "AUTOLOAD is localized to a blocks context" part of your question. Does that mean having different lookup-results (depending on scope) for the last-resort AUTOLOAD sub?
Sorry if I'm just being too dumb or having the wrong kind of humour. ;)
In reply to Re^3: goto &method and skipping call frame
by shmem
in thread goto &method and skipping call frame
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |