Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected warning under mod_perl #918

Closed
p5pRT opened this issue Dec 6, 1999 · 3 comments
Closed

Unexpected warning under mod_perl #918

p5pRT opened this issue Dec 6, 1999 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 6, 1999

Migrated from rt.perl.org#1856 (status was 'resolved')

Searchable as RT1856$

@p5pRT
Copy link
Author

p5pRT commented Dec 6, 1999

From pjordan1@ecid.cig.mot.com

I'm getting a warning when running a script under mod_perl that I don't
expect (or, indeed, see when running the same source as normal CGI). The
warning is​:

Variable "@​lookup" will not stay shared at
/tape_factory2/www/httpd/perl/scripts/orders/deploy/list line 17.

and the relevant code snippet is​:

{
  my @​lookup=qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);

  sub renderDate($) {
  my $date=shift;
  $date ? "$date->[2]$lookup[$date->[1]]$date->[0]" : '-' # line 17
  }
}

perldiag he say "An inner (nested) named subroutine is referencing a
lexical variable defined in an outer subroutine."

I say that I have an outer /block/ and the code is entirely legit. The
code does what's expected, but I neither wish to disable -w nor have my
error_log filled with spurious warnings...

Thoughts?

Pete Jordan
Motorola GSM
use Disclaimer​::Standard;

Perl Info


Site configuration information for perl 5.00503:

Configured by pjordan1 at Mon Nov  1 14:14:16 GMT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos imogen 5.6 generic_105181-14 sun4u sparc sunw,ultra-enterprise '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc -B/usr/ccs/bin/ -B/usr/ccs/bin/', optimize='-O', gccversion=2.95.1 19990816 (release)
    cppflags='-I/local/include'
    ccflags ='-I/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc -B/usr/ccs/bin/ -B/usr/ccs/bin/', ldflags =''
    libpth=/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G'

Locally applied patches:
    


@INC for perl 5.00503:
    /local/lib/perl5/5.00503/sun4-solaris
    /local/lib/perl5/5.00503
    /local/lib/perl5/site_perl/5.005/sun4-solaris
    /local/lib/perl5/site_perl/5.005
    .


Environment for perl 5.00503:
    HOME=/home/pjordan1
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/local/lib:/usr/ucblib:/usr/lib/xmlib:/usr/openwin/lib:/usr/vendor/motif/1.2.3/IXImd12s/lib
    LOGDIR (unset)
    PATH=/home/pjordan1/bin:/local/bin:/home/pjordan1/bin/sun4-solaris:/share/pd/bin:/tape_factory2/www/bin:/usr/bin:/usr/sbin:/etc:/usr/ccs/bin:/usr/local/bin:/usr/openwin/bin
    PERL_BADLANG (unset)
    SHELL=/bin/ksh

@p5pRT
Copy link
Author

p5pRT commented Dec 6, 1999

From [Unknown Contact. See original ticket]

At 17​:49 06/12/1999 +0000, Pete Jordan wrote​:

I'm getting a warning when running a script under mod_perl that I don't
expect (or, indeed, see when running the same source as normal CGI). The
warning is​:

It is typical to get warnings under mod_perl which you wouldn't get
otherwise as the situation is quite different from a run-and-die script.
And while there may be things that could or should be fixed on the p5p
side, it's usually better to ask on the modperl side first.

You don't send enough info about your modperl setup so I'm only guessing,
but I'm pretty sure this is a typical issue, and not a bug. The answers
you're looking for are at
http​://www.perlreference.com/mod_perl/guide/porting.html#Exposing_Apache_Reg
istry_secret . The rest of the Guide is worth reading too.

What is most likely happening is that your sub is being wrapped into
another sub by Apache​::Registry when it precompiles your code, thus leading
to the nested subs which you don't see when looking at the source.

.Robin
Critic, n.​: A person who boasts himself hard to please because nobody tries
to please him.

@p5pRT
Copy link
Author

p5pRT commented Dec 6, 1999

From [Unknown Contact. See original ticket]

Robin Berjon <robin@​knowscape.com> wrote​:

http​://www.perlreference.com/mod_perl/guide/porting.html#Exposing_Apache
_Registry_secret

Ahh... Thanks for that link. Exceeding useful and it explains what's going
on. It's harmless in my case, given my closure is of a read-only lookup
table, I'll just have to cope with the warnings (or accept the inelegance
of making the table package-global).

--
Pete Jordan ~ Horus Communications Ltd ~ http​://www.horus.cix.co.uk/

"'Not twisted,' Salzy once said of her own passion, 'it is helical.
That sounds better.'"

@p5pRT p5pRT closed this as completed Nov 28, 2003
jkeenan pushed a commit that referenced this issue Nov 29, 2023
1.302197  2023-11-28 17:30:37-08:00 America/Los_Angeles

    - Add ability to attach timestamps to trace objects via api or env var

1.302196  2023-10-24 10:27:33-07:00 America/Los_Angeles

    - Fix #882
    - Fix handling of VSTRING and LVALUE refs in is_deeply() #918
    - Merge several doc fixes from mauke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant