develooper Front page | perl.perl5.porters | Postings from November 2005

[perl #37722] interpolated tie()d variable weirdness

Thread Next
From:
Michele Dondi
Date:
November 21, 2005 08:44
Subject:
[perl #37722] interpolated tie()d variable weirdness
Message ID:
rt-3.0.11-37722-124704.18.1739715661365@perl.org
# New Ticket Created by  Michele Dondi 
# Please include the string:  [perl #37722]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37722 >


This is a bug report for perl from blazar@lcm.mi.infn.it,
generated with the help of perlbug 1.35 running under perl v5.8.6.


-----------------------------------------------------------------
I noticed a strange and appearently inconsistent behaviour (to the best of
my knowledge non documented) when a tie()d variable is put at the *beginning*
of an iterpolating string. Minimal example code follows:


#!/usr/bin/perl -l

use strict;
use warnings;

sub TIESCALAR { bless \my $i, shift }
sub FETCH { ${shift,}++ }

tie my $s, 'main';
print "$s$s$s";
print "$s$s$s";

tie my $t, 'main';
print " $t$t$t";
print " $t$t$t";

__END__


Output:


112
445
  012
   345


More details and further discussion at
http://perlmonks.org/index.pl?node_id=510411
-----------------------------------------------------------------
---
Flags:
     category=core
     severity=low
---
Site configuration information for perl v5.8.6:

Configured by Gentoo at Thu Aug  4 16:31:21 CEST 2005.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
   Platform:
     osname=linux, osvers=2.4.26, archname=i686-linux
     uname='linux xenon2 2.4.26 #3 smp fri jun 25 13:58:21 cest 2004 i686 intel(r) xeon(tm) cpu 2.40ghz genuineintel gnulinux '
     config_args='-des -Darchname=i686-linux -Dcccdlflags=-fPIC -Dccdlflags=-rdynamic -Dcc=gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth=  -Doptimize=-mcpu=athlon -O3 -pipe -Duselargefiles -Dd_semctl_semun -Dscriptdir=/usr/bin -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dinstallman1dir=/usr/share/man/man1 -Dinstallman3dir=/var/tmp/portage/perl-5.8.6-r5/image//usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dinc_version_list=5.8.0 5.8.0/i686-linux 5.8.2 5.8.2/i686-linux 5.8.4 5.8.4/i686-linux 5.8.5 5.8.5/i686-linux  -Dcf_by=Gentoo -Ud_csh -Di_ndbm -Di_gdbm -Di_db'
     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='gcc', ccflags ='-fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
     optimize='-mcpu=athlon -O3 -pipe',
     cppflags='-DPERL5 -fno-strict-aliasing -pipe'
     ccversion='', gccversion='3.3.5  (Gentoo Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)', 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=-lpthread -lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
     perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
     libc=/lib/libc-2.3.4.so, so=so, useshrplib=false, libperl=libperl.a
     gnulibc_version='2.3.4'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
     cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.6:
     /etc/perl
     /usr/lib/perl5/site_perl/5.8.6/i686-linux
     /usr/lib/perl5/site_perl/5.8.6
     /usr/lib/perl5/site_perl/5.8.0
     /usr/lib/perl5/site_perl/5.8.0/i686-linux
     /usr/lib/perl5/site_perl/5.8.4
     /usr/lib/perl5/site_perl/5.8.4/i686-linux
     /usr/lib/perl5/site_perl/5.8.5
     /usr/lib/perl5/site_perl/5.8.5/i686-linux
     /usr/lib/perl5/site_perl
     /usr/lib/perl5/vendor_perl/5.8.6/i686-linux
     /usr/lib/perl5/vendor_perl/5.8.6
     /usr/lib/perl5/vendor_perl/5.8.0
     /usr/lib/perl5/vendor_perl/5.8.0/i686-linux
     /usr/lib/perl5/vendor_perl/5.8.2
     /usr/lib/perl5/vendor_perl/5.8.2/i686-linux
     /usr/lib/perl5/vendor_perl/5.8.4
     /usr/lib/perl5/vendor_perl/5.8.4/i686-linux
     /usr/lib/perl5/vendor_perl/5.8.5
     /usr/lib/perl5/vendor_perl/5.8.5/i686-linux
     /usr/lib/perl5/vendor_perl
     /usr/lib/perl5/5.8.6/i686-linux
     /usr/lib/perl5/5.8.6
     /usr/local/lib/site_perl
     /usr/lib/perl5/site_perl/5.8.0
     /usr/lib/perl5/site_perl/5.8.0/i686-linux
     /usr/lib/perl5/site_perl/5.8.4
     /usr/lib/perl5/site_perl/5.8.4/i686-linux
     /usr/lib/perl5/site_perl/5.8.5
     /usr/lib/perl5/site_perl/5.8.5/i686-linux
     .

---
Environment for perl v5.8.6:
     HOME=/home/blazar
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH=/usr/lib/asterisk
     LOGDIR (unset)
     PATH=/bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.5:/opt/intel/compiler70/ia32/bin:/opt/ati/bin:/opt/Acrobat5:/opt/blackdown-jdk-1.4.1/bin:/opt/blackdown-jdk-1.4.1/jre/bin:/opt/sun-j2ee-1.3.1/bin:/usr/qt/3/bin:/usr/kde/3.3/bin:/usr/kde/3.2/bin:/usr/kde/3.1/bin:/usr/NX/bin:/usr/qt/2/bin:/usr/games/bin:/local/bin:/local/bin:/local/OpenOffice.org1.1.4/program:/home/blazar/bin:.
     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