On Mon, 13 Mar 2000, Lasker Kory wrote:

> I'm trying to use HTML::Parser 3.06 to subclass an object but keep receiving
> a very frustrating error.  It seems I cannot call a subclassed method
> against HTML::Parser without it complaining:
> 
> Here's the object:
> 
> package Sysweb::Templater::Required;
  ....
> sub new {
  ....
>    $self->handler( start => "_findreq", 'tagname, attr' );

does this help
   $self->handler( start => "_findreq", 'self,tagname, attr' );
                                       # ^^^^^
 .....


> sub _findreq {
>    my ($self, $tagname, $attr) = @_;
     #   ^^^^^^


There's some code in report_event() in hparser.c that leads
me to think that it calls methods when "self" is an arg
otherwise it just calls the function, which it appears
by your error message is looking in HTML::Parser
instead of your package

    if ((enum argcode)*argspec == ARG_SELF && !SvROK(h->cb)) {
      char *method = SvPV(h->cb, my_na);
      perl_call_method(method, G_DISCARD | G_VOID);
    }
    else {
      perl_call_sv(h->cb, G_DISCARD | G_VOID);
    }

In the Argspec section of the man page


       `self'
           Self causes the current object to be passed to the
           handler.  If the handler is a method, this must be the
           first element in the argspec.

Reply via email to