The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

grepl - grep through Perl documents.

USAGE

 grepl [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:

 grepl --search comments,heredocs --pattern 'XXX'

EXAMPLES

  • Quick 'n dirty SQL Injection attack scanner:

     grepl -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/?node_id=632518 for more information.

  • Search for TODO items in comments

     grepl --search comments --pattern '(?i:XXX|TODO)' lib/
  • Search for TODO items in comments and POD

     grepl --search comments,pod --pattern '(?i:XXX|TODO)' lib/
  • Search for '=head3', only listing filenames

    Older versions of Perl didn't recognize =head3 in POD.

     grepl --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.