in reply to Re: •Re: Is there a Apache::Template HOWTO
in thread Is there a Apache::Template HOWTO

I don't like the use of can there. Why not a simple callback with override:
sub param { my ($self, $request, $params) = @_; $params = $self->SUPER::params($request, $params); return { $self->custom_params($request, $params), %$params }; } sub custom_params { # override this in subclasses to return a list of additional # key/value pairs to be added to your global namespace return (); }

It simplifies the code tremendously, and it's also much faster.

Introspection is expensive. Avoid it when possible.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re: •Re: Re: •Re: Is there a Apache::Template HOWTO
by cleverett (Friar) on Jul 23, 2003 at 18:38 UTC
    > I don't like the use of can there. Why not a simple
    > callback with override:

    <snip>

    Ah, good point.

    > Introspection is expensive. Avoid it when possible.

    Out of the mouths of monks :)