There's no way you can do it perfectly reliably without AUTOLOAD because of Perl's poor introspection. And, as you note, if you miss a method you have a bug. You can either publish which methods you support (thus turning the bug into a "feature") or have your AUTOLOAD handle it. You might want to just check can (which returns a code ref). The following untested bit might help:
if (my $sub = $self->{DBI}->can($op)) { no strict 'refs'; *$op = $sub; }
You'd have to customize that for your needs, but it has the benefit of installing the subroutine directly into your namespace so you only take the AUTOLOAD hit on the first call.
Cheers,
Ovid
New address of my CGI Course.
In reply to Re^3: Using AUTOLOAD to create class methods
by Ovid
in thread Using AUTOLOAD to create class methods
by radiantmatrix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |