Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Using perl for refactoring

by GrandFather (Saint)
on Dec 09, 2014 at 11:28 UTC ( [id://1109706]=note: print w/replies, xml ) Need Help??


in reply to Using perl for refactoring

Well, start by parsing the .pm files for subs and build a list of them, then parse the .pl file looking for the sub names being used.

Even a simple /^\s*sub\s+(\w+)/ match to find the subs would get you 99% of the way there for most purposes. Then assemble a regex to match the sub names you found already and use that to search the main.pl for places the subs are used. Easy peasy.

Perl is the programming world's equivalent of English

Replies are listed 'Best First'.
Re^2: Using perl for refactoring
by Anonymous Monk on Dec 09, 2014 at 11:56 UTC

    sh find $dir -name '*.pm' \ | xargs awk '/^[ \t]*sub[ \t]+[_a-z0-9]+/ { print $2 }' \ | xargs -I % fgrep --word-regexp % *.pm

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-18 21:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found