http://qs321.pair.com?node_id=804255


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