Hi all,

This is my first mod_perl bug report, so I'd like to start by thanking you
all for your great work over the years.

The problem I am experiencing involves passing a scalar reference (instead
of a scalar) to $r->print().  It usually works as documented.  However I
have come across a situation where instead of printing the contents, it
prints the string version of the ref itself:  "SCALAR(0x8ca70e4)".

After some research, it seems that I can trigger this behavior by doing a
certain type of regex on the scalar reference, specifically: a successful
regex that includes a backreference.

Here is a short handler that demonstrates:

  package reftest;
  use strict;
  use warnings;

  sub handler {

      my $r = shift;
      $r->send_http_header("text/plain");

      my $data = "hello\n";
      my $dataref = \$data;

      # normally we can pass a reference to Apache's print
      $r->print($dataref);

      $$dataref =~ s/(h)/$1/;

      # but not if we've done a successful backreferenced pattern match
      $r->print($dataref);

  }

  1;

And in the conf file:

  PerlRequire /path/to/file/reftest.pl
  <Location /reftest>
      SetHandler perl-script
      PerlHandler reftest
  </Location>

On the first request to a given child, I get:

  hello
  SCALAR(0x8ca70e4)

On subsequent requests I get:

  SCALAR(0x8ca70e4)SCALAR(0x8ca70e4)

There are no messages in the error log when this happens.  I am using
Apache/1.3.28 (Unix) mod_perl/1.28 mod_ssl/2.8.15 OpenSSL/0.9.7b under
FreeBSD 4.6.2-release.  The output of perl -V is below.

Thanks in advance for your time, let me know if you need any further
information!

Jonathan Field

-------------------
--- perl -V output:

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=freebsd, osvers=4.6.2-release, archname=i386-freebsd
    uname='freebsd dev1.zappos.com 4.6.2-release freebsd 4.6.2-release #0:
wed aug 14 21:23:26 gmt 2002
[EMAIL PROTECTED]:usrsrcsyscompilegeneric i386 '
    config_args='-sde -Dprefix=/usr/home/zappos/zappos.com/perl
-Darchlib=/usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1/mach
-Dprivlib=/usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1
-Dman3dir=/usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1/man/man3
-Dsitearch=/usr/home/zappos/zappos.com/perl/lib/perl5/site_perl/5.6.1/mach
-Dsitelib=/usr/home/zappos/zappos.com/perl/lib/perl5/site_perl/5.6.1
-Ui_malloc -Ui_iconv
-Dccflags=-DAPPLLIB_EXP="/usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1/BSDPAN"
-Ui_gdbm -Dusemymalloc=n'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags
='-DAPPLLIB_EXP="/usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1/BSDPAN"
-fno-strict-aliasing -I/usr/local/include',
    optimize='-O -pipe ',

cppflags='-DAPPLLIB_EXP="/usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1/BSDPAN"
-fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.3 20010315 (release) [FreeBSD]',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lm -lc -lcrypt -lutil
    perllibs=-lm -lc -lcrypt -lutil
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fPIC', lddlflags='-shared  -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under freebsd
  Compiled at Aug 21 2002 18:35:52
  @INC:
    /usr/home/zappos/zappos.com/perl/lib/perl5/site_perl/5.6.1/mach
    /usr/home/zappos/zappos.com/perl/lib/perl5/site_perl/5.6.1
    /usr/home/zappos/zappos.com/perl/lib/perl5/site_perl
    /usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1/BSDPAN
    /usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1/mach
    /usr/home/zappos/zappos.com/perl/lib/perl5/5.6.1
    .


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

Reply via email to