On Sun, Mar 1, 2009 at 12:22 PM, Yitzchak Scott-Thoennes
<sthoenna@efn.org> wrote:
> On Sun, March 1, 2009 6:02 am, Rafael Garcia-Suarez wrote:
>> 2009/3/1 Gabor Szabo <szabgab@gmail.com>:
>>> Taken the following code using B::Deparse can insert the missing @_
>>> and @ARGV after the shift.
>
>>> On the other hand in the following examples it did not insert the
>>> implicitly used $_:
>
>>> Would it be possible to add that as an optional feature of B::Deparse?
>>
>> Certainly -- this is probably not very difficult to do, but that
>> probably requires to go through all the pp_ functions in B::Deparse that
>> correspond to ops that default to $_ to add that switch. A nice little
>> bite-sized patch to prepare for the interested ?
>
> Most ops that default to using $_ already show it in the deparse.
> m, s, and y/tr may be the only exceptions, because they actually
> compile differently with or without the $_=~.
I'm almost inclined to want to teach B::Deparse to emit lexical $_ vs
global $_ differently though that's a bad idea since we make no such
other distinction for any other lexical/global. As meta-data then...
global $_ is "colored red?" There might be room for a coloring
B::Deparse somewhere in the world.
if ( \e[31m$_\e[0m =~ /.../ ) {
# ha
}
$ /opt/perl-5.10.1/bin/perl -MO=Concise -e '/.../'
4 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
3 </> match(/"..."/) v/RTIME ->4
-e syntax OK
$ /opt/perl-5.10.1/bin/perl -MO=Concise -e 'my $_; /.../'
6 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
3 <0> padsv[$_:1,2] vM/LVINTRO ->4
4 <;> nextstate(main 2 -e:1) v:{ ->5
5 </> match(/"..."/)[$_:1,2] v/RTIME,16 ->6
-e syntax OK
$ /opt/perl-5.10.1/bin/perl -MO=Concise -e '$_ =~ /.../'
5 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
4 </> match(/"..."/) vKS/RTIME ->5
- <1> ex-rv2sv sK/1 ->4
3 <$> gvsv(*_) s ->4
-e syntax OK
$ /opt/perl-5.10.1/bin/perl -MO=Concise -e 'my $_; $_ =~ /.../'
7 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
3 <0> padsv[$_:1,2] vM/LVINTRO ->4
4 <;> nextstate(main 2 -e:1) v:{ ->5
6 </> match(/"..."/) vKS/RTIME ->7
5 <0> padsv[$_:1,2] s ->6
-e syntax OK
Josh
Thread Previous