[EMAIL PROTECTED] wrote: [...]
I guess there is still the question of why 'goto &NAME' doesn't work. Is this a bug? Is it a known bug?
Log.xs:16 does:
static void ApacheLog(int level, SV *sv, SV *msg) ... if((lmask == APLOG_DEBUG) && (s->loglevel >= APLOG_DEBUG)) { SV *caller; bool old_T = tainting; tainting = FALSE; caller = perl_eval_pv("[ (caller)[1,2] ]", TRUE); tainting = old_T; file = SvPV(*av_fetch((AV *)SvRV(caller), 0, FALSE),na); line = (int)SvIV(*av_fetch((AV *)SvRV(caller), 1, FALSE)); }
I've tested and caller called from a plain perl function works just fine. It's possible that this is just the behavior of any XS function. It'd try to write a simple XS function to test that.
I wonder why Doug had to go throught the pain of using eval_pv on caller to get the line numbers in XS. The following patch does it much simpler and seems to work even with 5.005_03. A Perl caller of an XS function is the same thing as the function itself, unless I miss something. May be it's needed when an XS function calls another XS function via eval_sv or something...
Index: src/modules/perl/Log.xs =================================================================== RCS file: /home/cvs/modperl/src/modules/perl/Log.xs,v retrieving revision 1.12 diff -u -r1.12 Log.xs --- src/modules/perl/Log.xs 25 Jan 2001 07:43:05 -0000 1.12 +++ src/modules/perl/Log.xs 20 Feb 2004 02:59:39 -0000 @@ -13,6 +13,12 @@ GvCV(gp) = perl_get_cv(from, TRUE); }
+#ifdef USE_ITHREADS +#define cop_file PL_curcop->cop_file +#else +#define cop_file SvPVX(GvSV(PL_curcop->cop_filegv)) +#endif + static void ApacheLog(int level, SV *sv, SV *msg) { dTHR; @@ -36,12 +42,8 @@ }
if((lmask == APLOG_DEBUG) && (s->loglevel >= APLOG_DEBUG)) { - SV *caller; - bool old_T = tainting; tainting = FALSE; - caller = perl_eval_pv("[ (caller)[1,2] ]", TRUE); - tainting = old_T; - file = SvPV(*av_fetch((AV *)SvRV(caller), 0, FALSE),na); - line = (int)SvIV(*av_fetch((AV *)SvRV(caller), 1, FALSE)); + file = cop_file; + line = PL_curcop->cop_line; }
if((s->loglevel >= lmask) &&
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html