It's definitely alpha code, but I've just released App::Pgrep. This installs pgrep on your machine. It's a PPI-powered grep. It's alpha and has many things it cannot yet search for. Currently we can only search through quoted text, heredocs, comments and POD. More features will be added in the future.
pgrep - grep through Perl documents.
USAGE pgrep [options] [files or directory]
Options which take arguments
-p, --pattern A Perl regular expression to match against. Default to the empty string. -s, --search What parts of the Perl document to search in. Defaults to C<--search quote,heredoc>.
-w, --warnings Enable warnings -l Filenames only -h, --help Display this help -?, Display this help -H, --man Longer manpage for prove
The following parts of Perl documents may be searched for:
Matches quoted strings (but not heredocs).
--search argument can accept a comma separate list of items to search
We'll add more things you can search for later.
All items may be plural to make them easier to read:
pgrep --search comments,heredocs --pattern 'XXX'
pgrep -pattern '^\s*(?i:select|insert|update|delete).*=\s*'?[\$\@]'
Because we default to searching for 'quote' and 'heredoc' elements, the above searches them for things like:
DELETE FROM table WHERE name='$name'
Due to the nature of SQL injection attacks, the above is very limited. See http://www.perlmonks.org/ for more information.
pgrep --search comments --pattern '(?i:XXX|TODO)' lib/
pgrep --search comments,pod --pattern '(?i:XXX|TODO)' lib/
Older versions of Perl didn't recognize
=head3 in POD.
pgrep --search pod --pattern '^=head3' -l
--files are not supplied, assumes we're search from the
current directory on down.
ack, included with
This is alpha code. You've been warned.