Perl::ToPerl6::Annotation - A "## no mogrify" annotation in a document.
use Perl::ToPerl6::Annotation; $annotation = Perl::ToPerl6::Annotation->new( -element => $no_mogrify_ppi_element ); $bool = $annotation->disables_line( $number ); $bool = $annotation->disables_policy( $policy_object ); $bool = $annotation->disables_all_transformers(); ($start, $end) = $annotation->effective_range(); @disabled_policy_names = $annotation->disabled_transformers();
Perl::ToPerl6::Annotation represents a single "## no mogrify" annotation in a PPI:Document. The Annotation takes care of parsing the annotation and keeps track of which lines and Policies it affects. It is intended to encapsulate the details of the no-mogrify annotations, and to provide a way for Transformer objects to interact with the annotations (via a Perl::ToPerl6::Document).
Perl::ToPerl6::Annotation
"## no mogrify"
This is considered to be a non-public class. Its interface is subject to change without notice.
Given a Perl::ToPerl6::Document, finds all the "## no mogrify" annotations and constructs a new Perl::ToPerl6::Annotation for each one and returns them. The order of the returned objects is not defined. It is generally expected that clients will use this interface rather than calling the Perl::ToPerl6::Annotation constructor directly.
new( -element => $ppi_annotation_element )
Returns a reference to a new Annotation object. The -element argument is required and should be a PPI::Token::Comment that conforms to the "## no mogrify" syntax.
PPI::Token::Comment
disables_line( $line )
Returns true if this Annotation disables $line for any (or all) Policies.
$line
disables_policy( $policy_object )
disables_policy( $policy_name )
Returns true if this Annotation disables $polciy_object or $policy_name at any (or all) lines.
$polciy_object
$policy_name
disables_all_transformers()
Returns true if this Annotation disables all Policies at any (or all) lines. If this method returns true, disabled_transformers will return an empty list.
disabled_transformers
effective_range()
Returns a two-element list, representing the first and last line numbers where this Annotation has effect.
disabled_transformers()
Returns a list of the names of the Policies that are affected by this Annotation. If this list is empty, then it means that all Policies are affected by this Annotation, and disables_all_transformers() should return true.
element()
Returns the PPI::Element where this annotation started. This is typically an instance of PPI::Token::Comment.
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
Copyright (c) 2005-2011 Imaginative Software Systems. 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.
To install Perl::ToPerl6, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::ToPerl6
CPAN shell
perl -MCPAN -e shell install Perl::ToPerl6
For more information on module installation, please visit the detailed CPAN module installation guide.