Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: perl determine a subroutine name by given line

by duelafn (Vicar)
on Aug 05, 2011 at 11:05 UTC ( #918733=note: print w/replies, xml ) Need Help??

in reply to Re: perl determine a subroutine name by given line
in thread perl determine a subroutine name by given line

Not quite. It seems to give the line number where the subroutine becomes known to perl. Thus, if the sub is used before it is defined the line numbers will be wrong. Example:

#!/usr/bin/perl use 5.010; say f( 34 ); sub f { $_[0] + 8 }

Then, perl -MO=Xref,d /tmp/ gives (among other things):

Package main &f s3

Which is the line where f is used, not defined.

This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi

Good Day,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://918733]
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: (11)
As of 2016-10-26 17:55 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (345 votes). Check out past polls.