Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: B::Deparse vs. O=Deparse

by ikegami (Patriarch)
on Oct 31, 2009 at 02:00 UTC ( #804255=note: print w/replies, xml ) Need Help??

in reply to B::Deparse vs. O=Deparse

shouldn't it be "B::Deparse"?"

perl -MB::Deparse -e"foo()"
is the same as
perl -e"use B::Deparse; foo()"

You can use Deparse to see that:

>perl -MO=Deparse -MB::Deparse -e"foo()" use B::Deparse; foo(); -e syntax OK

B::Deparse loads functions to deparse Perl code. But since you never use the module, it's rather useless to load the module.

O, on the other hand, behaves very specially when loaded. It loads the program, dumps it using the specified dumper (e.g B::Deparse), and prevents it from executing as if -c had been specified.

>perl -MO=Deparse -e"foo()" foo(); -e syntax OK >perl -MO=Concise -e"foo()" 6 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 5 <1> entersub[t2] vKS/TARG,1 ->6 - <1> ex-list K ->5 3 <0> pushmark s ->4 - <1> ex-rv2cv sK ->- 4 <#> gv[*foo] s/EARLYCV ->5 -e syntax OK >perl -MO=Terse -e"foo()" LISTOP (0x19298c0) leave [1] OP (0x19298a4) enter COP (0x19298e4) nextstate UNOP (0x1929920) entersub [2] UNOP (0x192995c) null [142] OP (0x1929940) pushmark UNOP (0x1929980) null [17] PADOP (0x19299a0) gv GV (0x182a00c) *foo -e syntax OK

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2023-03-31 13:26 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (75 votes). Check out past polls.