Perl::ToPerl6::Utils::PPI - Utility functions for dealing with PPI objects.


Provides classification of PPI::Elements.


This is considered to be a public module. Any changes to its interface will go through a deprecation cycle.


dscanf( $format_string, {options=1} )>
    'a' -
    'b' -
    'c' -
    'd' - Specify an integer in an arbitrary base.
          If you want integers in a base other than decimal, add a modifier:
          'bd' - Binary integer
          'od' - Octal integer
          'xd' - Hexadecimal integer
    'e' -
    'f' - Specify a floating-point number.
          If you want floating-point numbers in exponential notation, add
          a modifier:
          'ef' - Exponential number
    'g' -
    'h' -
    'i' -
    'j' -
    'k' -
    'l' -
    'm' -
    'n' -
    'o' -
    'p' -
    'q' -
    'r' - Specify a regular expression.
          Note that this will match C</foo/>, C<s/foo/bar/>, C<y/a-m/n-z/>.
          If you want to match a specific regex type, then preface 'r' with:
          'mr' - Matching regular expression
          'sr' - Substitution regular expression
          'tr' - Transliterating regular expression
    's' - Specify a quoted string.
          This will match both C<'foo'> and C<qq qfooq> by default.
          If you want to match a specific string type, then preface 's' with:
          'ds' - Double-quoted string
          'ls' - Literal string type
          'ss' - Single-quoted string
          'is' - Interpolated string
    't' -
    'u' -
    'v' - Specify a Perl variable.
          If you want a specific type of variable, add one of these modifiers:
          'av' - Array variable
          'gv' - GLOB variable
          'hv' - Hash variable
          'sv' - Scalar variable
    'w' -
    'x' -
    'y' -
    'z' -

    'A' -
    'B' -
    'C' -
    'D' -
    'E' -
    'F' -
    'G' -
    'H' -
    'I' -
    'J' -
    'K' -
    'L' - A list.
    'M' -
    'N' -
    'O' -
    'P' - An explicit L<PPI> node type, C<'%P{Token::Word}'> for instance.
          You can prefix this with C<'PPI::'> but it's considered redundant.
    'Q' -
    'R' -
    'S' -
    'T' -
    'U' -
    'V' -
    'W' -
    'X' -
    'Y' -
    'Z' -
is_ppi_expression_or_generic_statement( $element )

Answers whether the parameter is an expression or an undifferentiated statement. I.e. the parameter either is a PPI::Statement::Expression or the class of the parameter is PPI::Statement and not one of its subclasses other than Expression.

is_ppi_generic_statement( $element )

Answers whether the parameter is an undifferentiated statement, i.e. the parameter is a PPI::Statement but not one of its subclasses.

is_ppi_statement_subclass( $element )

Answers whether the parameter is a specialized statement, i.e. the parameter is a PPI::Statement but the class of the parameter is not PPI::Statement.

is_ppi_simple_statement( $element )

Answers whether the parameter represents a simple statement, i.e. whether the parameter is a PPI::Statement, PPI::Statement::Break, PPI::Statement::Include, PPI::Statement::Null, PPI::Statement::Package, or PPI::Statement::Variable.


Jeffrey Goff <>


Elliot Shank <>


Copyright (c) 2007-2011 Elliot Shank.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module.