Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Deparse isn't as reliable as I thought

by PodMaster (Abbot)
on Mar 03, 2006 at 22:37 UTC ( #534383=note: print w/ replies, xml ) Need Help??


in reply to Deparse isn't as reliable as I thought

Not exactly :)

C:\>perl -MO=Concise -e"@f = split ' ', shift" 9 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 8 <@> split[t5] vK ->9 3 </> pushre(/"\\s+"/ => @f) s*/64 ->4 6 <1> shift sK/1 ->7 5 <1> rv2av[t4] sKRM/1 ->6 4 <#> gv[*ARGV] s ->5 7 <$> const[IV 0] s ->8 -e syntax OK C:\>perl -MO=Concise -e"@f = split /\s+/, shift" 9 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 8 <@> split[t5] vK ->9 3 </> pushre(/"\\s+"/ => @f) s/64 ->4 6 <1> shift sK/1 ->7 5 <1> rv2av[t4] sKRM/1 ->6 4 <#> gv[*ARGV] s ->5 7 <$> const[IV 0] s ->8 -e syntax OK C:\>perl -MO=Concise -e"@f = split ?\s+?, shift" 9 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 8 <@> split[t5] vK ->9 3 </> pushre(/"\\s+"/ => @f) s/64 ->4 6 <1> shift sK/1 ->7 5 <1> rv2av[t4] sKRM/1 ->6 4 <#> gv[*ARGV] s ->5 7 <$> const[IV 0] s ->8 -e syntax OK
B::Deparse cautions you that the output might not be what you expect (or that it might be a bug, which you should report), but B::Concise seems to agree that there's no difference (but don't take my word for it, it might just be a similar bug).

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.


Comment on Re: Deparse isn't as reliable as I thought
Download Code
Replies are listed 'Best First'.
Re^2: Deparse isn't as reliable as I thought
by harleypig (Scribe) on Mar 04, 2006 at 00:21 UTC

    Thanks. I didn't know about Concise.

    The only difference I can see in these two is the asterisk (*):

    </> pushre(/"\\s+"/ => @f) s*/64 ->4 (split " ") </> pushre(/"\\s+"/ => @f) s/64 ->4 (split ?\s+?)

    The most I've been able to find out is that the '*' means 'do something weird for this op' and a reference to op.h, which says 'On pushre, re is /\s+/ imp. by split " "'. We already know this.

    So this is gonna have to be one of those cases where I'm just gonna have to accept it as a peculiarity of perl. This is not a big issue as I won't be running into this any time soon again.

    Also, the magic only happens when assigning to an array, using in implied contexts or assigning to a scalar the " " is *not* converted to ?\s+?.

    Harley J Pig
Re^2: Deparse isn't as reliable as I thought
by ambrus (Abbot) on Mar 05, 2006 at 23:35 UTC

    Well, Concise doesn't even distingush between

    perl -MO=Concise -we 'warn "foo"=~/f./g'
    and
    perl -MO=Concise -we 'warn "foo"=~/f./'
    so I wouldn't trust it so much.

      See what happens when you put that into a list context:

      C:\>perl -MO=Concise -e"'foofoo' =~ /f../" 5 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 4 </> match(/"f.."/) vKS/RTIME ->5 3 <$> const[PV "foofoo"] s ->4 -e syntax OK C:\>perl -MO=Concise -e"'foofoo' =~ /f../g" 5 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 4 </> match(/"f.."/) vKS/RTIME ->5 3 <$> const[PV "foofoo"] s ->4 -e syntax OK C:\>perl -MO=Concise -e"() = 'foofoo' =~ /f../g" 8 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 7 <2> aassign[t1] vKS/COMMON ->8 - <1> ex-list lK ->6 3 <0> pushmark s ->4 5 </> match(/"f.."/) lKS/RTIME ->6 4 <$> const[PV "foofoo"] s ->5 - <1> ex-list lK ->7 6 <0> pushmark s ->7 - <0> stub lPRM* ->- -e syntax OK

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://534383]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2015-07-30 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls