develooper Front page | perl.perl5.porters | Postings from March 2009

entereval is not entertry

Thread Next
From:
Dan Kogai
Date:
March 12, 2009 09:43
Subject:
entereval is not entertry
Message ID:
10F5E814-EBD3-4A62-A4E9-47F4886DFF15@dan.co.jp
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Porters,

I found this when I was having fun with ops.pm.

% perl -M-ops=entereval -e 'eval qq{die}'
'eval "string"' trapped by operation mask at -e line 1.
% perl -M-ops=entereval -e 'eval {die}'
'eval "string"' trapped by operation mask at -e line 1.

% perl -M-ops=entertry -e 'eval {die}'
% perl -M-ops=entertry -e 'eval qq{die}'

As you see this, -ops=entereval catches both entereval and entertry  
while -ops=entertry caches neither.

% perl -MO=Terse -e 'eval qq{die}'
LISTOP (0x301cb0) leave [1]
     OP (0x308130) enter
     COP (0x302370) nextstate
     UNOP (0x307bf0) entereval [256]
         SVOP (0x308910) const [2] PV (0x804a90) "die"
- -e syntax OK
% perl -MO=Terse -e 'eval {die}'
LISTOP (0x3086f0) leave [1]
     OP (0x308310) enter
     COP (0x302370) nextstate
     LISTOP (0x307bf0) leavetry
         LOGOP (0x308130) entertry
         COP (0x3083f0) nextstate
         LISTOP (0x308910) die [1]
             OP (0x301cb0) pushmark
- -e syntax OK

How sad you can't outlaw eval qq{ STRING } without sacrificing eval  
{ BLOCK }...

Dan the OPMasked

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkm5O5YACgkQErJia/WXtBsRqQCcCBt7hFa9+2RQ9f1A6nhTjQ+y
1+0An2lBkw9B7gTprW5rP/Xz9UDQ7L7L
=h+Zf
-----END PGP SIGNATURE-----

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