Using Apache/1.3.27 (Unix) mod_gzip/1.3.26.1a mod_perl/1.27, perl
5.8.0.

Hi,

I'm working with some servers which print debugging messages through a
wrapper function that calls Apache::Log::debug, here is a simplified
version:

sub mydebug {
    my $msg = shift;
    Apache->server()->log()->debug($msg);
}

Since Apache::Log::debug inserts the file and line number of its
calling location into each log entry, this means that our log entries
all contain the same file and line number, corresponding to the
location of the Apache::Log::debug call inside 'mydebug'.

I'm trying to figure out how to get Apache::Log to use the correct
file and line numbers, i.e. those of the caller of our wrapper
function, instead. The perlfunc man page suggests that the 'goto
&NAME' form of 'goto' can be used to trick 'caller', but rewriting the
wrapper function in the following manner:

sub mydebug {
    my $msg = shift;
    @_=(Apache->server()->log(), $msg);
    goto &Apache::Log::debug;
}

doesn't change the behavior - it still manages to print the file and
line number of the 'goto' statement, not of the caller of 'mydebug'.
Can anyone help us with this?

Thanks in advance,

Frederik Eaton


Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.20, archname=i686-linux-64int
    uname='linux yourmom 2.4.20 #4 smp thu feb 27 15:11:19 pst 2003 i686 unknown '
    config_args='-Duse64bitint -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing'
    ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1 2.96-98)', 
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =''
    libpth=/lib /usr/lib
    libs=-lnsl -ldl -lm -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
    libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.4'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_64_BIT_INT USE_LARGE_FILES
  Built under linux
  Compiled at Feb  5 2003 07:25:46

-- 
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

Reply via email to