[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: very old bug report about internal_redirect



:-> "Geoffrey" == Geoffrey Young <geoff@modperlcookbook.org> writes:

    >> With this setup, the error message changes:
    >> Now I have:
    >> [Sun Nov  9 20:17:26 2003] [error] Can't call method "content_type"
    >> on an undefined value at /usr/local/lib/site_perl/bug130883/Impl1.pm
    >> line 10.
    >> when I try to access /R

    > that error makes more sense.

    > here, what is happening is that your handler is being called, but not
    > as a method handler - meaning the

    >    my $self = shift;

    > in Impl1::handler() is getting $r, thus leaving the call to

    >    my $req = shift;

    > with an empty argument list.


    > ok, if you could try a few things for me, that would be great.

    > first, try prototyping all the method handlers with

    > sub handler : method {

    > instead of using ($$).


Hello, sorry for the late reply but I had 2 very bad days at work :(

I've tried replacing '($$)' with ': method'

and I now get this when accessing /R

[Wed Nov 12 08:11:37 2003] [error] Can't locate object method
"internal_redirect" via package "bug130883::Redir" at
/usr/local/lib/site_perl/bug130883/Redir.pm line 9.

I'll try the patch later.


Pf

    > next, try applying the attached patch and see if it helps at all (both
    > with $$ and : method).

    > thanks

    > --Geoff

    > Index: src/modules/perl/mod_perl.c
    > ===================================================================
    > RCS file: /home/cvspublic/modperl/src/modules/perl/mod_perl.c,v
    > retrieving revision 1.147
    > diff -u -r1.147 mod_perl.c
    > --- src/modules/perl/mod_perl.c	2 Oct 2003 21:30:35 -0000	1.147
    > +++ src/modules/perl/mod_perl.c	9 Nov 2003 21:59:05 -0000
    > @@ -1231,20 +1231,33 @@
    >  	if (gvp) cv = GvCV(gvp);
    >      }
 
    > +    if (cv != NULL) {
    > +      is_method = perl_cv_ismethod(cv);
    > +    }
    > +
    > +    MP_TRACE_h(fprintf(stderr, "checking if `%s' is a method...%s\n", 
    > +	   sub, (is_method ? "yes" : "no")));
    > +    SvREFCNT_dec(sv);
    > +    return is_method;
    > +}
    > +
    > +int perl_cv_ismethod(CV *cv)
    > +{
    > +    int is_method=0;
    > +
    >  #ifdef CVf_METHOD
    >      if (cv && (CvFLAGS(cv) & CVf_METHOD)) {
    >          is_method = 1;
    >      }
    >  #endif
    > +
    >      if (!is_method && (cv && SvPOK(cv))) {
    >  	is_method = strnEQ(SvPVX(cv), "$$", 2);
    >      }
 
    > -    MP_TRACE_h(fprintf(stderr, "checking if `%s' is a method...%s\n", 
    > -	   sub, (is_method ? "yes" : "no")));
    > -    SvREFCNT_dec(sv);
    >      return is_method;
    >  }
    > +
    >  #endif
 
    >  void mod_perl_noop(void *data) {}
    > @@ -1486,6 +1499,7 @@
    >      HV *stash = Nullhv;
    >      SV *pclass = newSVsv(sv), *dispsv = Nullsv;
    >      CV *cv = Nullcv;
    > +    GV *gv = Nullgv;
    >      char *method = "handler";
    >      int defined_sub = 0, anon = 0;
    >      char *dispatcher = NULL;
    > @@ -1620,8 +1634,27 @@
    >  #endif
    >      }
    >      else {
    > -	MP_TRACE_h(fprintf(stderr, "perl_call: handler is a %s\n", 
    > -			 dispatcher ? "dispatcher" : "cached CV"));
    > +        if (!dispatcher) {
    > +	  MP_TRACE_h(fprintf(stderr, "perl_call: handler is a cached CV\n"));
    > +#ifdef PERL_METHOD_HANDLERS
    > +          cv = sv_2cv(sv, &stash, &gv, FALSE);
    > +
    > +          if (cv != NULL) {
    > +	    is_method = perl_cv_ismethod(cv);
    > +          }
    > +
    > +          if (is_method) {
    > +              sv_setpv(pclass, HvNAME(stash));
    > +              method = GvNAME(CvGV(cv));
    > +          }
    > +
    > +          MP_TRACE_h(fprintf(stderr, "checking if CV is a method...%s\n",
    > +                 (is_method ? "yes" : "no")));
    > +#endif
    > +        }
    > +	else {
    > +          MP_TRACE_h(fprintf(stderr, "perl_call: handler is a dispatcher\n"));
    > +        }
    >      }
 
    >  callback:

    > -- 
    > Reporting bugs: http://perl.apache.org/bugs/
    > Mail list info: http://perl.apache.org/maillist/modperl.html

-- 

-------------------------------------------------------------------------------
 Pierfrancesco Caci | ik5pvx | mailto:p.caci@tin.it  -  http://gusp.dyndns.org
  Firenze - Italia  | Office for the Complication of Otherwise Simple Affairs 
     Linux penny 2.6.0-test9 #1 Fri Oct 31 22:51:12 CET 2003 i686 GNU/Linux



Reply to: