develooper Front page | perl.perl5.porters | Postings from March 2000

[ID 20000324.027] Conditionally evaluated subroutines

James Duncan
March 24, 2000 06:33
[ID 20000324.027] Conditionally evaluated subroutines
Message ID:
This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00565.

This is quite a strange one -- I'm not sure if it is a bug, or if it is
intended behaviour.  If it is intended behavior then I'm not sure I
understand why this is the case.

I've run it under several versions of perl, and this code always
in Goodbye being sent to STDOUT, which strikes me as a little strange.

if (1) {
  eval { sub test { print "Hello"; }  }
} else {
  eval { sub test { print "Goodbye" } }


However, the following piece of code works as expected:

if (1) {
  eval 'sub test { print "Hello" };'
} else {
  eval 'sub test { print "Goodbye" };'


[Please do not change anything below this line]

This perlbug was built using Perl 5.00503 - Fri Oct  1 13:09:46 IST 1999
It is being executed now by  Perl 5.00565 - Tue Feb 29 19:36:30 GMT

Site configuration information for perl 5.00565:

Configured by james at Tue Feb 29 19:36:30 GMT 2000.

Summary of my perl5 (revision 5.0 version 5 subversion 650)
    osname=linux, osvers=2.2.5-15smp, archname=i686-linux-thread-multi
    uname='linux 2.2.5-15smp #1 smp mon apr 19
22:43:28 edt 1999 i686 unknown '
    config_args='-ds -e -DDEBUGGING -Dusethreads -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
    usesocks=undef useperlio=undef d_sfio=undef
    use64bits=undef uselargefiles=define usemultiplicity=define
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux
(egcs-1.1.2 release)
    cppflags='-D_REENTRANT -Dbool=char -DHAS_BOOL -fno-strict-aliasing
    ccflags ='-D_REENTRANT -Dbool=char -DHAS_BOOL -fno-strict-aliasing
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:

@INC for perl 5.00565:

Environment for perl 5.00565:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    SHELL=/bin/bash Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About