develooper Front page | perl.perl5.porters | Postings from December 2009

[perl #71154] undef &$coderef consistency

Thread Next
From:
Nicholas Clark
Date:
December 10, 2009 04:18
Subject:
[perl #71154] undef &$coderef consistency
Message ID:
rt-3.6.HEAD-12359-1260398527-1897.71154-75-0@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #71154]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=71154 >



This is a bug report for perl from nick@ccl4.org,
generated with the help of perlbug 1.39 running under perl 5.11.2.


-----------------------------------------------------------------
[Please describe your issue here]

$ ./perl -e '$a = sub {}; warn "Before: $a"; undef &$a; warn "After $a"; $a->()'
Before: CODE(0x100815848) at -e line 1.
After CODE(0x100815848) at -e line 1.
Not a CODE reference at -e line 1.

only it sure does look like a CODE reference. Even to Devel::Peek:

$ ./perl -Ilib -MDevel::Peek -e '$a = sub {}; undef &$a; Dump $a'
SV = IV(0x100815858) at 0x100815860
  REFCNT = 1
  FLAGS = (ROK)
  RV = 0x100815878
  SV = PVCV(0x100814820) at 0x100815878
    REFCNT = 2
    FLAGS = (PADMY,WEAKOUTSIDE)
    COMP_STASH = 0x100803d38    "main"
    ROOT = 0x0
    GVGV::GV = 0x100803ff0      "main" :: "__ANON__"
    FILE = "(null)"
    DEPTH = 0
    FLAGS = 0x10
    OUTSIDE_SEQ = 96
    PADLIST = 0x0
    OUTSIDE = 0x1008040e0 (MAIN)

I'm not sure what the right answer here is.

Nicholas Clark

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.11.2:

Configured by nick at Tue Dec  8 18:23:09 GMT 2009.

Summary of my perl5 (revision 5 version 11 subversion 2) configuration:
  Commit id: bb61cbbfe4f34b8082fca34dd9dd82cae6aaa146
  Platform:
    osname=darwin, osvers=10.0.0, archname=darwin-thread-multi-2level
    uname='darwin mouse-mill.local 10.0.0 darwin kernel version 10.0.0: fri jul 31 22:47:34 pdt 2009; root:xnu-1456.1.25~1release_i386 i386 '
    config_args='-Dusedevel=y -Dcc=ccache gcc-mp-4.4 -Dld=gcc-mp-4.4 -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list=  -Dinc_version_list_init=0 -Doptimize=-Os -Dusethreads -Accflags=-DNO_MATHOMS -Uusemymalloc -Duseperlio -Dprefix=~/Sandpit/snap5.9.x-v5.11.2-138-gbb61cbb -Dinstallman1dir=none -Dinstallman3dir=none -Uuserelocatableinc -Ud_dosuid -Uuseshrplib -Umad -de -Accccflags=-DNO_PERL_PRESERVE_IVUV'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='ccache gcc-mp-4.4', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -DNO_MATHOMS -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include',
    optimize='-Os',
    cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -DNO_MATHOMS -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include'
    ccversion='', gccversion='4.4.1', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/opt/local/lib'
    libpth=/opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/opt/local/lib -fstack-protector'

Locally applied patches:
    

---
@INC for perl 5.11.2:
    lib
    /Users/nick/Sandpit/snap5.9.x-v5.11.2-138-gbb61cbb/lib/perl5/site_perl/5.11.2/darwin-thread-multi-2level
    /Users/nick/Sandpit/snap5.9.x-v5.11.2-138-gbb61cbb/lib/perl5/site_perl/5.11.2
    /Users/nick/Sandpit/snap5.9.x-v5.11.2-138-gbb61cbb/lib/perl5/5.11.2/darwin-thread-multi-2level
    /Users/nick/Sandpit/snap5.9.x-v5.11.2-138-gbb61cbb/lib/perl5/5.11.2
    .

---
Environment for perl 5.11.2:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/nick
    LANG=en_GB.ISO8859-1
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/local/bin:/opt/local/sbin:/Users/nick/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/sbin:/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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