I have a couple of oddities. One, called incgrep, works like recursive grep except for two features. First, it reports one line for each file that has the search string with the line numbers after like this:
search_string: some_file 4 12 189 other_file 29 283
This is very useful for quickly seeing which files are calling a certain sub, etc.

The second feature is odder yet. If the search string is a directory name, then instead of looking for the string itself, it uses the file names in that directory as search strings looking for each of them. This was supposed to be useful for looking for all the templates used in a project:

shell-prompt: incgrep global/template/dir form.tt: App/Main.pm 24 114 App/Modules/Name.pm 41 error.tt: App/Main.pm 181
I don't actually use it that way much.

Another script is showsub. It usually takes a sub name and a module file name. It dumps out the whole sub from that module. (It's not very smart, it looks for 'sub name' at the left margin and dumps from there to the first closing brace at the margin.) It can also take the output from incgrep. Then it looks in all the files mentioned there for the sub provided.

Another one is searchinc. It takes a regex, a starting perl file and (optionally) a list of directories which could be part of @INC. It looks for the regex in the starting file and in anything it uses recursively. Again, its not overly smart and only looks for easy to spot use statements. I also have a version for C, since I once spent a bit of time digesting a large code base in C. The C version is more useful, Perl doesn't hide as many symbols.

My most useful little tools are the ones the move me to the directories where our different projects live. I can type cdb AppName to move the build directory for an app and cda AppName to move to the lib path for it. These are my most typed commands.

Phil


In reply to Re: Private Utilities by philcrow
in thread Private Utilities by Ovid

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.