[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[perl #62584] Method interpretation in A::B->C



# New Ticket Created by  Peter Scott 
# Please include the string:  [perl #62584]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=62584 >


A call to A::B->C is interpreted as calling A::B if that subroutine is 
defined, even if subroutine A::B::C is also defined.  But it calls 
A::B::C if A::B is not defined.  That's nasty action at a distance - 
code suddenly stops working when a new and apparently unrelated 
subroutine is introduced.  I think that A::B->C should always call 
A::B::C().  Seems to have been this way forever (tested on 5.10.0, 
5.8.8, 5.6.1).


% perl -MO=Deparse -e 'A::B->C()'
'A::B'->C;
-e syntax OK

% perl -MO=Deparse -e 'sub A::B{} A::B->C()'
sub A::B {

}
A::B()->C;
-e syntax OK

% perl -MO=Deparse -e 'sub A::B{} sub A::B::C{} A::B->C()'
sub A::B {

}
sub A::B::C {

}
A::B()->C;
-e syntax OK



Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
   Platform:
     osname=linux, osvers=2.6.25-14.fc9.i686, archname=i686-linux
     uname='linux bugs.homeip.net 2.6.25-14.fc9.i686 #1 smp thu may 1 
06:28:41 edt 2008 i686 i686 i386 gnulinux '
     config_args='-des -DDEBUGGING'
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=undef, usemultiplicity=undef
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=undef, use64bitall=undef, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -pipe 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm',
     optimize='-O2 -g',
     cppflags='-DDEBUGGING -fno-strict-aliasing -pipe 
-I/usr/local/include -I/usr/include/gdbm'
     ccversion='', gccversion='4.3.0 20080428 (Red Hat 4.3.0-8)', 
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, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
     libc=/lib/libc-2.8.so, so=so, useshrplib=false, libperl=libperl.a
     gnulibc_version='2.8'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
     cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib'


Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
                         USE_LARGE_FILES USE_PERLIO
   Built under linux
   Compiled at Oct 16 2008 15:55:32
   @INC:
     /usr/local/lib/perl5/5.10.0/i686-linux
     /usr/local/lib/perl5/5.10.0
     /usr/local/lib/perl5/site_perl/5.10.0/i686-linux
     /usr/local/lib/perl5/site_perl/5.10.0
     .



Follow-Ups from:
Ben Morrow <ben@morrow.me.uk>
Eric Brine <ikegami@adaelis.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]