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

Re: Displaying implicit $_ usage with B::Deparse

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
March 1, 2009 06:03
Subject:
Re: Displaying implicit $_ usage with B::Deparse
Message ID:
b77c1dce0903010602v1c0a69c0o6b69de2a5406de54@mail.gmail.com
2009/3/1 Gabor Szabo <szabgab@gmail.com>:
> Taken the following code using B::Deparse can insert the missing @_
> and @ARGV after the shift.
>
> my $filename = shift;
> sub foo {
>   my $x = shift;
> }
>
>
> On the other hand in the following examples it did not insert the implicitly
> used $_:
>
> if ($line = /something/) {
> }
>
> foreach (@arr) {
>   if (/abc/) {
>      print;
>   }
> }
>
>
> 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 ?

Thread Previous | 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