Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Optree sorrows

by LanX (Saint)
on Jul 11, 2020 at 21:05 UTC ( [id://11119188]=perlquestion: print w/replies, xml ) Need Help??

LanX has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I noticed that B::Xref had problems listing a subroutine so I took a look into the optree only to see that the name isn't properly displayed there.

file 1 and 2 are only different in the order of sub definition and call. as you can see at the line marked as ### the name fooxx is missing in version 2.

What's the problem?

I actually also did a Xref,-r which was buggy too, (the definition of &fooxx was located in in the B.pm file) but the output is just too verbose, to be shown here.

D:\exp>perl -MO=Xref,-d t_XREF_bug1.pl File t_XREF_bug1.pl Subroutine (main) Package main &fooxx &1 ### t_XREF_bug1.pl syntax OK D:\exp>perl -MO=Xref,-d t_XREF_bug2.pl File t_XREF_bug2.pl Subroutine (main) Package (lexical) &? &4 ### t_XREF_bug2.pl syntax OK D:\exp> D:\exp>type t_XREF_bug1.pl fooxx(); sub fooxx { print @_; } D:\exp>perl -MO=Concise,-stash="main",-main,-src t_XREF_bug1.pl FUNC: *main::fooxx ### 6 <1> leavesub[1 ref] K/REFC,1 ->(end) - <@> lineseq KP ->6 # 3: print @_; 1 <;> nextstate(main 2 t_XREF_bug1.pl:3) v ->2 5 <@> print sK ->6 2 <0> pushmark s ->3 4 <1> rv2av[t2] lK/1 ->5 3 <#> gv[*_] s ->4 main program: c <@> leave[1 ref] vKP/REFC ->(end) 7 <0> enter ->8 # 1: fooxx(); 8 <;> nextstate(main 1 t_XREF_bug1.pl:1) v:{ ->9 b <1> entersub[t2] vKS/TARG ->c - <1> ex-list K ->b 9 <0> pushmark s ->a - <1> ex-rv2cv sK/1 ->- a <#> gv[*fooxx] s/EARLYCV ->b ### # 6: - <;> ex-nextstate(main 3 t_XREF_bug1.pl:6) v:{ ->c t_XREF_bug1.pl syntax OK D:\exp>type t_XREF_bug2.pl sub fooxx { print @_; } fooxx(); D:\exp>perl -MO=Concise,-stash="main",-main,-src t_XREF_bug2.pl FUNC: *main::constant:: ### 6 <1> leavesub[1 ref] K/REFC,1 ->(end) - <@> lineseq KP ->6 # 2: print @_; 1 <;> nextstate(main 2 t_XREF_bug2.pl:2) v ->2 5 <@> print sK ->6 2 <0> pushmark s ->3 4 <1> rv2av[t2] lK/1 ->5 3 <#> gv[*_] s ->4 main program: c <@> leave[1 ref] vKP/REFC ->(end) 7 <0> enter ->8 # 4: fooxx(); 8 <;> nextstate(main 3 t_XREF_bug2.pl:4) v:{ ->9 b <1> entersub vKS ->c - <1> ex-list K ->b 9 <0> pushmark s ->a - <1> ex-rv2cv sK/1 ->- a <#> gv[IV \] s ->b ### t_XREF_bug2.pl syntax OK D:\exp>

update

B::Deparse seems to get it right though.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11119188]
Approved by davies
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found