in reply to Re: plugins and inheritance
in thread plugins and inheritance

That sounds rather clever to me. So, my AUTOLOAD routine would check for plugins with the required subroutine, but failing that would just use the default. In effect, all my subroutines would be routed via AUTOLOAD first...

Yeah, that is a really nice solution - my only worry wd be, will all the AUTOLOAD calls consume a lot of time and CPU? I guess there's no easy way round that anyway. If I want easy plugins, I have to get runtime subroutine lookups.

thanks a lot
dave

Replies are listed 'Best First'.
Re: Re: Re: plugins and inheritance
by tomhukins (Curate) on Feb 28, 2001 at 04:07 UTC

    If your subroutines don't do much work, or you're calling them recursively, then the overhead of an AUTOLOAD technique might be prohibitive. Otherwise, I wouldn't worry about it.

    I recall Damian Conway's Object Oriented Perl describing a technique to declare subroutines when AUTOLOAD is called, so after the first call there is no AUTOLOAD overhead. If you're concerned enough, you might want to investigate that.

    Update: The syntax for this is:

    *{$name_of_subroutine_to_create} = \&Name::of::existing::subroutine