Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
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.
NAME
pgrep - grep through Perl documents.
USAGE pgrep [options] [files or directory]
OPTIONS
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>.
Boolean options
-w, --warnings Enable warnings -l Filenames only -h, --help Display this help -?, Display this help -H, --man Longer manpage for prove
SEARCHES
The following parts of Perl documents may be searched for:
quote Matches quoted strings (but not heredocs).
heredoc Matches heredocs.
pod Matches POD.
comment Matches comments.
The --search argument can accept a comma separate list of items to search
for:
--search pod,heredoc,quote
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'
EXAMPLES
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
NOTES
Default Directory
If --dir or --files are not supplied, assumes we're search from the
current directory on down.
SEE ALSO
ack, included with App::Ack.
CAVEATS
This is alpha code. You've been warned.
What's wrong with grep (Score:2)
grepdepends on the shell to expand globs into a list of filenames, and this breaks down when your start descending into directories.Re: (Score:2)
There's nothing wrong with grep. However, it's a different tool that attempts to satisfy a different need. I often want to search parts of a Perl document without searching all of it. Being able to search just through DATA sections or perhaps dump all regular expressions can be hand. You may have different needs. As time goes on, I'll be adding new features and it will be even more useful.
Also, I was going to add file extension support, but I decided to put that off as "not needed" for the first iter
Re: (Score:1)
pgrep (Score:2)
Re: (Score:2)
Ah, crud. I hadn't heard of the command, so I didn't think to search for it. Thanks for the heads up. Recommendations welcome!
Re: (Score:1)
plgrep?
Re: (Score:1)
Hmm, that’s taken too. But ppgrep isn’t. Google only finds someone who uses that as their nickname and a page showing a Perl script called ppgrep that isn’t mentioned anywhere else.