Stop (caller $n)[6] from including final "\n;"
authorFather Chrysostomos <sprout@cpan.org>
Tue, 28 Aug 2012 05:38:57 +0000 (22:38 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 28 Aug 2012 06:24:03 +0000 (23:24 -0700)
commit19bcb54e626c56999bd22347f278ae81abf0eb1c
tree9a5f83593cf5d83a3a89ed97d5b9a61ec2854a74
parent11076590cd9927694bccd96456ab149a3a7bb432
Stop (caller $n)[6] from including final "\n;"

String eval appends "\n;" to the string before evaluating it.
(caller $n)[6], which returns the text of the eval, was giving the
modified string, rather than the original.

In fact, it was returning the actual string buffer that the parser
uses.  This commit changes it to create a new mortal SV from that
string buffer, but without the last two characters.

It unfortunately breaks this JAPH:

eval'BEGIN{${\(caller 2)[6]}=~y< !"$()+\-145=ACHMT^acfhinrsty{}>
<nlrhta"o Pe e,\nkrcrJ uthspeia">}say if+chr(1) -int"145"!=${^MATCH}'
pp_ctl.c
t/op/caller.t