The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

DESCRIPTION

Provides classification of PPI::Elements.

INTERFACE SUPPORT

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

IMPORTABLE SUBS

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_subroutine_declaration( $element )

Is the parameter a subroutine declaration, named or not?

is_in_subroutine( $element )

Is the parameter a subroutine or inside one?

get_constant_name_element_from_declaring_statement($statement)

Given a PPI::Statement, if the statement is a use constant or Readonly declaration statement, return the name of the thing being defined.

Given

use constant 1.16 FOO => 'bar';

this will return "FOO". Similarly, given

Readonly::Hash my %FOO => ( bar => 'baz' );

this will return "%FOO".

AUTHOR

Elliot Shank <perl@galumph.com>

COPYRIGHT

Copyright (c) 2007-2009 Elliot Shank. All rights reserved.

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.