NAME

Perl::Critic::Annotation - Represents a "## no critic" marker

SYNOPSIS

use Perl::Critic::Annotation;
$annotation = Perl::Critic::Annotation->new( -token => $no_critic_ppi_token );

$bool = $annotation->disables_line( $number );
$bool = $annotation->disables_policy( $policy_object );
$bool = $annotation->disables_all_policies();

($start, $end) = $annotation->effective_range();
@disabled_policy_names = $annotation->disabled_policies();

DESCRIPTION

Perl::Critic::Annotation represents a single "## no critic" marker in a PPI:Document. The Annotation takes care of parsing the markers and keeps track of which lines and Policies it affects. It is intended to encapsulate the details of the no-critic markers, and to provide a way for Policy objects to interact with the markers (via a Perl::Critic::Document).

CONSTRUCTOR

new( -token => $ppi_annotation_token )

Returns a reference to a new Annotation object. The -token argument is required and should be a PPI::Token::Comment that conforms to the "## no critic" syntax.

METHODS

disables_line( $line )

Returns true if this Annotation disables $line for any (or all) Policies.

disables_policy( $policy_object )
disables_policy( $policy_name )

Returns true if this Annotation disables $polciy_object or $policy_name at any (or all) lines.

disables_all_policies()

Returns true if this Annotation disables all Policies at any (or all) lines. If this method returns true, disabled_policies will return an empty list.

effective_range()

Returns a two-element list, representing the first and last line numbers where this Annotation has effect.

disabled_policies()

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_policies() should return true.

token()

Returns the PPI::Token::Comment where this annotation started.

AUTHOR

Jeffrey Ryan Thalhammer <thaljef@cpan.org>

COPYRIGHT

Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. 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.