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

filehandle methods interfere with internal implementation details #10438

Open
p5pRT opened this issue Jun 14, 2010 · 5 comments
Open

filehandle methods interfere with internal implementation details #10438

p5pRT opened this issue Jun 14, 2010 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 14, 2010

Migrated from rt.perl.org#75734 (status was 'open')

Searchable as RT75734$

@p5pRT
Copy link
Author

p5pRT commented Jun 14, 2010

From @nwc10

Created by @nwc10

$ ~/Reference/5.8.0/bin/perl -lwe '$_ = chr 0x2020; print /\W/'
1
$ ~/Reference/5.8.0/bin/perl -lwe 'BEGIN {fileno utf8} $_ = chr 0x2020; print /\W/'
Name "main​::utf8" used only once​: possible typo at -e line 1.
Can't locate object method "SWASHNEW" via package "IO​::Handle".

That certainly isn't *documented* behaviour from the regexp engine.

[Still present in blead]

There needs to be a way to call methods on classes that isn't subject to
"filehandles take priority". Otherwise the internals can be tricked,
accidentally or deliberately.

Nicholas Clark

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl v5.8.0:

Configured by nwc10 at Fri Jan 13 14:56:47 GMT 2006.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=freebsd, osvers=5.4-stable, archname=i386-freebsd
    uname='freebsd colon.colondot.net 5.4-stable freebsd 5.4-stable #3: sat oct 15 10:50:35 bst 2005 mbm@colonii.colondot.net:usrobjusrsrcsyscolon i386 '
    config_args='-Dprefix=~/Reference/5.8.0 -Doptimize=-Os -Uuse64bitint -Uusethreads -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list=  -Dinc_version_list_init=0 -Uinstallman1dir -Uinstallman3dir -Dmalloctype=void * -Dfreetype=void -de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef 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='ccache gcc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include',
    optimize='-Os',
    cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.4.2 [FreeBSD] 20040728', 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='gcc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lgdbm -lm -lc -lcrypt -lutil
    perllibs=-lm -lc -lcrypt -lutil
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fPIC', lddlflags='-shared  -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.0:
    /export/home/nwc10/Reference/5.8.0/lib/perl5/5.8.0/i386-freebsd
    /export/home/nwc10/Reference/5.8.0/lib/perl5/5.8.0
    /export/home/nwc10/Reference/5.8.0/lib/perl5/site_perl/5.8.0/i386-freebsd
    /export/home/nwc10/Reference/5.8.0/lib/perl5/site_perl/5.8.0
    /export/home/nwc10/Reference/5.8.0/lib/perl5/site_perl
    .


Environment for perl v5.8.0:
    HOME=/export/home/nwc10
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/export/home/nwc10/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/export/home/nwc10/bin:/usr/local/sbin:/sbin:/usr/sbin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2010

From @jandubois

On Mon, 14 Jun 2010, Nicholas Clark (via RT) wrote​:

There needs to be a way to call methods on classes that isn't subject to
"filehandles take priority". Otherwise the internals can be tricked,
accidentally or deliberately.

I kind of expected that suffixing the classname with "​::" would help (which
is already needed if you have a sub with the same name as the class​:

  $ perl -E 'package foo; sub bar { say "baz" } package main; sub foo { "xyzzy" } foo->bar'
  Can't locate object method "bar" via package "xyzzy" (perhaps you forgot to load "xyzzy"?) at -e line 1.

  $ perl -E 'package foo; sub bar { say "baz" } package main; sub foo { "xyzzy" } foo​::->bar'
  baz

But it doesn't help with the "filehandles take priority" case​:

  $ perl -E 'package foo; sub bar { say "baz" } package main; BEGIN { fileno foo } foo​::->bar'
  Can't locate object method "bar" via package "IO​::Handle" at -e line 1.

I wonder if it should...

Cheers,
-Jan

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2010

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2010

From @cpansprout

On Mon Jun 14 05​:22​:26 2010, nicholas wrote​:

$ ~/Reference/5.8.0/bin/perl -lwe '$_ = chr 0x2020; print /\W/'
1
$ ~/Reference/5.8.0/bin/perl -lwe 'BEGIN {fileno utf8} $_ = chr
0x2020; print /\W/'
Name "main​::utf8" used only once​: possible typo at -e line 1.
Can't locate object method "SWASHNEW" via package "IO​::Handle".

That certainly isn't *documented* behaviour from the regexp engine.

How about adding a flag to call_method? Should it begin with the G_
prefix like the other flags? We could call it G_NOIO. But G_ stands for
gimme and this would be specific to call_method. So what should it be
called?

@khwilliamson
Copy link
Contributor

The regex engine no longer uses swashes, so the demonstration code of this ticket no longer fails. @nwc10 is this still a problem? If so a different demonstration is needed

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

3 participants