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

overload loses caller's context #9100

Closed
p5pRT opened this issue Nov 2, 2007 · 4 comments
Closed

overload loses caller's context #9100

p5pRT opened this issue Nov 2, 2007 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 2, 2007

Migrated from rt.perl.org#47119 (status was 'resolved')

Searchable as RT47119$

@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2007

From lbudney@pobox.com

Created by lbudney@pobox.com

Operators overloaded using overload.pm are ALWAYS called in a
scalar context, regardless of the caller's actual context. To
reproduce​:

#!/usr/bin/perl

package Splitter;
use overload '<>' => \&chars;

sub new {
  my $class = shift;
  my $string = shift;
  bless \$string, $class;
}

sub chars {
  my $self = shift;
  my @​chars = split //, $$self;
  return @​chars;
}

package main;

my $x = Splitter->new('foo');
print "$_\n" for <$x>;

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl v5.8.8:

Configured by Len Budney at Thu Apr 19 16:50:27 EDT 2007.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=linux, osvers=2.4.21-47.elsmp, archname=i386-linux
    uname='linux jeenyus.net 2.4.21-47.elsmp #1 smp wed jul 5 20:38:41 edt 2006 i686 i686 i386 gnulinux '
    config_args='-des -Doptimize=-O3 -mcpu=i686 -march=i386 -Dcc=gcc -Dcf_by=Len Budney -Dcf_email=sysadmin@jeenyus.net -Dperladmin=sysadmin@jeenyus.net -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dprivlib=/usr/lib/perl5/5.8.0 -Dsitelib=/usr/lib/perl5/site_perl/5.8.0 -Dvendorlib=/usr/lib/perl5/gsg_perl/5.8.0 -Uusethreads -Uuseithreads -Duselargefiles -Ud_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dusemymalloc -Dpager=/usr/bin/less -isr'
    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=y, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O3 -mcpu=i686 -march=i386',
    cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-56)', 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 =' -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.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.8:
    /home/budney/perl/i386-linux
    /home/budney/perl
    /usr/lib/perl5/5.8.0/i386-linux
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i386-linux
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/gsg_perl/5.8.0/i386-linux
    /usr/lib/perl5/gsg_perl/5.8.0
    /usr/lib/perl5/gsg_perl/5.8.0
    .


Environment for perl v5.8.8:
    HOME=/home/budney
    LANG=POSIX
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/budney/bin:/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2012

From @doy

Fixed in 6728836.

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2012

From [Unknown Contact. See original ticket]

Fixed in 6728836.

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2012

@doy - Status changed from 'new' to 'resolved'

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

1 participant