develooper Front page | perl.perl5.porters | Postings from October 2007

=?UTF-8?B?W3BlcmwgIzQ2OTg3XSBPTy1jYWxsIGZhaWx1cmVzLCBhdXRvdml2LWZ1bmN0?= =?UTF-8?B?aW9ucyAmIHRlc3RpbmcgdGhlaXIgZXhpc3RzIhtbRBtbRBtbRBtbRBtbRBtb?= =?UTF-8?B?RBtbRCIbbBtsaWUbImV4aXN0cyItYW5jZQ==?=

Thread Next
From:
Linda Walsh
Date:
October 28, 2007 17:07
Subject:
=?UTF-8?B?W3BlcmwgIzQ2OTg3XSBPTy1jYWxsIGZhaWx1cmVzLCBhdXRvdml2LWZ1bmN0?= =?UTF-8?B?aW9ucyAmIHRlc3RpbmcgdGhlaXIgZXhpc3RzIhtbRBtbRBtbRBtbRBtbRBtb?= =?UTF-8?B?RBtbRCIbbBtsaWUbImV4aXN0cyItYW5jZQ==?=
Message ID:
rt-3.6.HEAD-20149-1193606290-1345.46987-75-0@perl.org
# New Ticket Created by  Linda Walsh 
# Please include the string:  [perl #46987]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=46987 >



This is a bug report for perl from perl-diddler@tlinx.org,
generated with the help of perlbug 1.35 running under perl v5.8.8.

#!/usr/bin/perl -w
#use strict;	# can optionally enable to show no "unstrict" constructs

##
##	this prog demonstrates 3 related problems and a 4th example
##  that may also be a problem; (all 4, likely same cause)
##  See descriptive text below after __END__
##

{ package F;
  our $count=-1;
  sub boom { ++$count; $count==0 ? "two\n": $count==1 ?"one\n":"unprint\n";}
}
{ package KA; our @ISA = qw(F);
  ##  PROBLEM #1 'can' works even when 'boom' can't be called
  ##  PROBLEM #3b ( -- call to boom fails 2nd time through)
  ##  called as valid method
  sub innocent{ if ($_[0]->can("boom")) {$_[0]->boom; }}        #ln 18
  #
  sub laytrap { 
    { 
    my @dummy=(\&boom);                                         #ln 22
      #  (see comments below about 4th "concern")
      #  my $boom_defined=$dummy[0];                            #ln 24
      #  print "boom defined = " . defined $boom_defined;       #ln 25 
      #  print "; boom exists = " . exists $boom_defined;       #ln 26
      #  print "\n";                                            #ln 27
    } "zero:trap laid\n" 
  }
}
package main;
  my $o = bless [],"KA";

  ##  These two calls (boom & innocent work...
  print $o->boom;   print $o->innocent;

  ##  lay trap to break boom & innocent
  print $o->laytrap;

  ##  Now same two calls, boom & innocent, will fail:
  ##  PROBLEM #2 -- can no longer call parent method 'boom'
  ##  (using eval to catch error)
  eval {if ($o->can("boom")) {print $o->boom}};                #ln 43
  $@ && print "$@";

  ##  PROBLEM #3 - within 'innocent', call to 'boom' fails
  ##  this call terminates program (fatal Undefined error)
  print $o->innocent;

__END__

The above prog demonstrates three (3) OO-call related problems.
Perl autovivifies "\&boom" into "@dummy" in "sub laytrap" (ln 22,
above). This *interferes* with OO calls through a blessed ref
later on in program execution.

The 4th "problem is the commented-out section above numbered lines
"24-26" (in comments).  _*If*_ you can autovivify functions or
methods, then "exists()" should work with function references.
Instead, if you uncomment lines 24-27, you will get an error:
"exists argument is not a HASH or ARRAY element at ./pbug1 line 26."

On the other hand, if you allow "exists" to work with coderefs, 
why not "simple vars"?  I.e.: $a=\$b, then defined($a)=true, but
exists($a) would be 'false', meaning no space had been allocated 
to value "$b" (is undefined).

Sorry to bundle "4" problems together, but they appeared to be
related.  If you want me to created another bug for #4 (it is the
most different from the other 4), lemme know.
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.8.8:

Configured by rurban at Sun Jul  8 19:08:44 GMT 2007.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=cygwin, osvers=1.5.24(0.15642), archname=cygwin-thread-multi-64int
    uname='cygwin_nt-5.1 reini 1.5.24(0.15642) 2007-01-31 10:57 i686 cygwin '
    config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads -Uusemymalloc -Doptimize=-O3 -Dman3ext=3pm -Dusesitecustomize -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -Wdeclaration-after-statement',
    optimize='-O3',
    cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -Wdeclaration-after-statement'
    ccversion='', gccversion='3.4.4 (cygming special, gdc 0.12, using dmd 0.125)', 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=8, prototype=define
  Linker and Libraries:
    ld='ld2', ldflags =' -s -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib
    libs=-lgdbm -ldb -ldl -lcrypt -lgdbm_compat
    perllibs=-ldl -lcrypt -lgdbm_compat
    libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
    cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'

Locally applied patches:
    CYG01 - hints.cygwin.sh ldflags -s
    CYG02 - lib-ExtUtils-Embed insensitive against leading \\s
    CYG03 - lib-Test-Harness-Straps $ENV{PERL5LIB} = ''
    CYG04 - major.version.cygwin.sh cygperl-5_8.dll and not cygperl-5_8_x.dll
    CYG05 - add Win32CORE to core
    CYG07 - File-Spec-Cygwin-TMPDIR.patch
    Bug#38628 - allow legacy Cwd->cwd()
    Bug#40103 - File-Spec-case_tolerant.patch from 5.9.5

---
@INC for perl v5.8.8:
    /usr/lib/perl5/5.8/cygwin
    /usr/lib/perl5/5.8
    /usr/lib/perl5/site_perl/5.8/cygwin
    /usr/lib/perl5/site_perl/5.8
    /usr/lib/perl5/site_perl/5.8
    /usr/lib/perl5/vendor_perl/5.8/cygwin
    /usr/lib/perl5/vendor_perl/5.8
    /usr/lib/perl5/vendor_perl/5.8
    .

---
Environment for perl v5.8.8:
    CYGWIN=notitle glob:ignorecase export
    HOME=/home/law
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=.:/sbin:/usr/sbin:/home/law/scripts:/home/law/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/bin:/usr/lib:/WINDOWS/system32:/WINDOWS:/WINDOWS/System32/Wbem:/Prog/XP-Support Tools:/Prog/sysinternals:/Prog/Codeplay:/Prog/Common Files/GTK/2.0/bin:/Prog/Microsoft Visual Studio/Tools:/usr/lib/lapack:/c/Prog/Sysinternals/cmd
    PERL_BADLANG (unset)
    SHELL=C:/bin/bash.exe


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About