develooper Front page | perl.perl5.porters | Postings from February 2006

[perl #38631] tied variables don't work with .= <>

Thread Next
From:
Nicholas Clark
Date:
February 25, 2006 03:40
Subject:
[perl #38631] tied variables don't work with .= <>
Message ID:
rt-3.0.11-38631-130590.8.19985844971399@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #38631]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38631 >



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


-----------------------------------------------------------------
[Please enter your report here]

$ cat tie_rcatline.pl
#!/usr/bin/perl -w
use strict;
use vars qw($a $b $v $x);

require Tie::Scalar;

tie $a, 'Tie::StdScalar', "A: ";
tie $b, 'Tie::StdScalar', "B: ";

tie $v, 'Tie::StdScalar', "5: ";
tie $x, 'Tie::StdScalar', "10: ";

my $junk = $a;
my $junk2 = $v;

$a .= <DATA>;
$b .= <DATA>;
$v .= <DATA>;
$x .= <DATA>;

print $a;
print $b;
print $v;
print $x;

__DATA__
One
Two
Three
Four
$ perl tie_rcatline.pl
A: One
Two
5: Three
Four


This would be a bug :-)

Worked with 5.6.1. I suspect that it's because 5.8.0 was optimised to use
the rcatline op. I also think I know why it's happening - a check for SvOK()
in do_readline, without any preceding magic get. Although in turn I don't
think that the solution is necessarily quite as simple as adding a magic get.

Nicholas Clark

[Please do not change anything below this line]
-----------------------------------------------------------------
---
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


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