--- demerphq <[EMAIL PROTECTED]> wrote:

> > The problem is this line in Template::Timer:
> >
> >   my $super = __PACKAGE__->can("SUPER::$sub") or die;
> >
> > This is OO code and that should actually read:
> >
> >   my $super = __PACKAGE__->can($sub) or die;
> 
> Er, i dont see how it could. Then $super would have a reference to
> its own method and not its parents.

I should have posted more context.  What's happening is that
Template::Timer inherits from Template::Context and that line merely
checks that two methods which it inherits actually are available.  If
they are, it wraps them in timing code.  It does *not* implement those
methods directly so it can't have a reference to its own method.

An alternative would be to do search @ISA or refer to the base class
directly:

  my $super = Template::Context->can($sub) or die;

That's a bit ugly and not really in the OO spirit, but it also works
around the fact that it doesn't play well with UNIVERSAL::can.

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to