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

NAME

PPIx::Grep - Search PPI documents (not Perl code).

VERSION

This document describes PPIx::Grep version 0.0.6.

SYNOPSIS

    use PPIx::Grep qw< run set_print_format >;

    set_print_format('%f> %s\n');  # Yes, single quotes.
    my $return_code = run( qw< include lib/PPIx/Grep.pm > );

DESCRIPTION

This is the guts of ppigrep. You're most likely more interested in that.

INTERFACE

Nothing is exported by default, but you can import everything using the :all tag.

run(@ARGV)

Parse command-line options, find PPI elements, and emit the results.

Returns the expected exit value for the program. This value is equivalent to the one for grep. If a match was found, this is 0. If no match was found, this is 1. And if any problems occurred, this is 2.

set_stdout($destination)

Specifies where the regular output will go.

set_stderr($destination)

Specifies where the error output will go.

set_match($regex)

Sets the pattern that elements will be matched against. This needs to be a compiled regex and not merely a string.

set_print_format($format)

Sets the format to be used to emit an individual PPI::Element. Note that newlines are not automatically printed for each Element; if you want them, you need to specify them as part of the parameter.

DIAGNOSTICS

Could not figure out what PPI class to use for "%s".

The pattern argument could not be resolved to a subclass of PPI::Element via PPIx::Shorthand.

Could not find any PPI::Element subclasses to use for "%s".

The pattern argument didn't resolve to any PPI::Element subclasses. Did you specify the empty string?

Invalid regex "%s": %s.

The regex specified via --match could not be compiled.

"%s" does not exist.

Cannot find the file.

"%s" is not readable.

Cannot read the file.

"%s" is a directory.

The "file" was actually a directory.

Could not parse "%s".

PPI could not interpret the file as a Perl document.

CONFIGURATION AND ENVIRONMENT

None, currently.

DEPENDENCIES

Getopt::Long List::MoreUtils PPI::Document PPIx::Shorthand String::Format

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

· This thing is way too limited in functionality.

Please report any bugs or feature requests to bug-ppix-grep@rt.cpan.org, or through the web interface at http://rt.cpan.org.

SEE ALSO

App::Ack App::Grepl

AUTHOR

Elliot Shank <perl@galumph.com>

LICENSE AND COPYRIGHT

Copyright ©2007-2008, Elliot Shank <perl@galumph.com>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.