Front page | perl.perl5.porters |
Postings from March 2001
[ID 20010330.003] O=Deparse,-p does not preserve "operationalsemantics"
Thread Next
From:
Robin Barker
Date:
March 30, 2001 10:21
Subject:
[ID 20010330.003] O=Deparse,-p does not preserve "operationalsemantics"
Message ID:
200103301821.TAA11593@tempest.npl.co.uk
This is a bug report for perl from rmb1@cise.npl.co.uk,
generated with the help of perlbug 1.26 running under perl 5.00503.
-----------------------------------------------------------------
[Please enter your report here]
I presumed that the output of perl -MO=Deparse should be the same
(have the same semantics as) the input; at least to the extent
that the two perl fragments produced the same output.
e.g.
% perl -MO=Deparse orig.pl > deparse.pl
Then
% perl orig.pl
% perl deparse.pl
give the same output.
I also expected that the output of O=Deparse,-p would also give
the same output. But ...
% cat orig.pl
my $xyz = (1,2); print $xyz,"\n"
% perl orig.pl
2
% perl -MO=Deparse orig.pl > deparse.pl
orig.pl syntax OK
% cat deparse.pl
my $xyz = ('???', 2);
print $xyz, "\n";
% perl deparse.pl
2
% perl -MO=Deparse,-p orig.pl > deparse-p.pl
orig.pl syntax OK
% cat deparse-p.pl
(my($xyz) = ('???', 2));
print($xyz, "\n");
% perl deparse-p.pl
???
The problem is that the extra brackets round $xyz in C<my($xyz)>
are not just syntax, they change the sematics by giving list
context to the assignment.
I had a look at B::Deparse.pm but I can't see how to fix this.
Robin
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Site configuration information for perl 5.00503:
Configured by root at Sat Sep 11 15:08:44 BST 1999.
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos capulin 5.6 generic_105181-10 sun4m sparc sunw,sparcstation-20 '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='gcc -B/usr/ccs/bin/', optimize='-O', gccversion=2.95.1 19990816 (release)
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Locally applied patches:
---
@INC for perl 5.00503:
/home/rmb1/appl/lib/perl5/site_perl
/home/rmb1/appl/lib/perl5/site_perl/5.005/sun4-solaris
/home/rmb1/appl/lib/perl5/site_perl/5.005
/usr/local/lib/perl5/5.00503/sun4-solaris
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005
.
---
Environment for perl 5.00503:
HOME=/home/rmb1
LANG=C
LANGUAGE (unset)
LD_LIBRARY_PATH=/usr/lib
LOGDIR (unset)
PATH=/home/rmb1/appl/script:/opt/SUNWspci/bin/:/usr/tempest/bin:/usr/local/bin:/usr/local/Admigration/exec:/usr/local/hotjava/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin:/usr/bin
PERL5LIB=/home/rmb1/appl/lib/perl5/site_perl:/home/rmb1/appl/lib/perl5/site_perl/5.005
PERL_BADLANG (unset)
SHELL=/bin/csh
Thread Next
-
[ID 20010330.003] O=Deparse,-p does not preserve "operationalsemantics"
by Robin Barker