Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: determine the name of a function that contains a specified string

by Ratazong (Prior)
on Mar 30, 2012 at 11:23 UTC ( #962572=note: print w/ replies, xml ) Need Help??


in reply to determine the name of a function that contains a specified string

The easiest way would be not to go back: Just search for ipconfig and sub in parallel. If you find a sub, just store the related function-name (as this is the function you are currently in). And if you find an ipconfig, just take that name.

update begin You could also do a two-pass-reading: in the first pass you would read all functions that are defined in your file, and store their name and the line where they start. In the second pass you would search for your keyword, check the line where it occurs and use this to determine the function name. update end

You will of course still need to handle the case of your keywords occuring in strings, comments and so on...

HTH, Rata


Comment on Re: determine the name of a function that contains a specified string
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-09-19 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (135 votes), past polls