Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Redispatching AUTOLOAD for failure

by jhourcle (Prior)
on Apr 15, 2008 at 01:44 UTC ( #680411=note: print w/ replies, xml ) Need Help??


in reply to Redispatching AUTOLOAD for failure

I'd probably avoid autoload, and just assign the subroutine. Based on what I think you're trying to do, I'd probably have an init function in Base that would setup whatever I might need. Obviously, you'd want to assign '$is_func' to handle your method names relative to the package names.

package Base; sub init { my $class = shift; my $is_func = $class.'::is_'.lc($class); no strict 'refs'; *$is_func = sub { return 1 }; } ... package Foo; our @ISA = qw( Base ); __PACKAGE__->init(); ... package Bar; our @ISA = qw( Base ); __PACKAGE__->init();


Comment on Re: Redispatching AUTOLOAD for failure
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://680411]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2013-05-26 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (521 votes), past polls