This works in Perl 5.12.3 (Slackware Linux 13.37 64 bit):
#!/usr/bin/perl use strict; use warnings; my $text="Hello World\n123\njust a short text\n"; my $r=\$text; open my $f,'<',$r or die "open failed: $!"; print while <$f>; close $f;
Output:
Hello World 123 just a short text
Adding a layer causes a file not found error:
#!/usr/bin/perl use strict; use warnings; my $text="Hello World\n123\njust a short text\n"; my $r=\$text; open my $f,'<:raw',$r or die "open failed: $!"; print while <$f>; close $f;
Output:
open failed: No such file or directory at test.pl line 9.
The same code worked flawlessly on Perl 5.10.0 (Slackware Linux 13.0 32 bit).
Bug in 5.12.3? Or did I miss some documented change?
perl -V:
Summary of my perl5 (revision 5 version 12 subversion 3) configuration +: Platform: osname=linux, osvers=2.6.35.10, archname=x86_64-linux-thread-multi uname='linux midas64 2.6.35.10 #2 smp thu jan 6 19:06:19 cst 2011 +x86_64 amd athlon(tm) ii x2 235e processor authenticamd gnulinux ' config_args='-de -Dprefix=/usr -Dvendorprefix=/usr -Dcccdlflags=-f +PIC -Dinstallprefix=/usr -Dlibpth=/usr/local/lib64 /usr/lib64 /lib64 +-Doptimize=-O2 -fPIC -Dusethreads -Duseithreads -Dpager=/usr/bin/less + -isr -Dinc_version_list=5.12.2 5.12.1 5.12.0 5.10.1 5.10.0 5.8.8 5.8 +.7 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 -Darchname=x86_64-linux' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing + -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_ +FILE_OFFSET_BITS=64', optimize='-O2 -fPIC', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -f +stack-protector -I/usr/local/include' ccversion='', gccversion='4.5.2', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector' libpth=/usr/local/lib64 /usr/lib64 /lib64 libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib64/libc-2.12.2.so, so=so, useshrplib=false, libperl=libpe +rl.a gnulibc_version='2.12.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -fPIC -fstack-protector +' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_ +BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API Built under linux Compiled at Jan 26 2011 12:39:46 @INC: /usr/lib64/perl5/site_perl/5.12.3/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.12.3 /usr/lib64/perl5/vendor_perl/5.12.3/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.12.3 /usr/lib64/perl5/5.12.3/x86_64-linux-thread-multi /usr/lib64/perl5/5.12.3 /usr/lib64/perl5/site_perl /usr/lib64/perl5/vendor_perl .
Alexander
In reply to Perl 5.12: layers and opening scalars as file handles by afoken
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |