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


In reply to Optree sorrows by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.