1Perl::Critic::AnnotatioUns(e3r)Contributed Perl DocumentPaetrilo:n:Critic::Annotation(3)
2
3
4

NAME

6       Perl::Critic::Annotation - A "## no critic" annotation in a document.
7

SYNOPSIS

9         use Perl::Critic::Annotation;
10         $annotation = Perl::Critic::Annotation->new( -element => $no_critic_ppi_element );
11
12         $bool = $annotation->disables_line( $number );
13         $bool = $annotation->disables_policy( $policy_object );
14         $bool = $annotation->disables_all_policies();
15
16         ($start, $end) = $annotation->effective_range();
17         @disabled_policy_names = $annotation->disabled_policies();
18

DESCRIPTION

20       Perl::Critic::Annotation represents a single "## no critic" annotation
21       in a <PPI:Document>.  The Annotation takes care of parsing the
22       annotation and keeps track of which lines and Policies it affects.  It
23       is intended to encapsulate the details of the no-critic annotations,
24       and to provide a way for Policy objects to interact with the
25       annotations (via a Perl::Critic::Document).
26

INTERFACE SUPPORT

28       This is considered to be a non-public class.  Its interface is subject
29       to change without notice.
30

CLASS METHODS

32       create_annotations( -doc => $doc )
33           Given a Perl::Critic::Document, finds all the "## no critic"
34           annotations and constructs a new Perl::Critic::Annotation for each
35           one and returns them.  The order of the returned objects is not
36           defined.  It is generally expected that clients will use this
37           interface rather than calling the Perl::Critic::Annotation
38           constructor directly.
39

CONSTRUCTOR

41       "new( -element => $ppi_annotation_element )"
42           Returns a reference to a new Annotation object.  The -element
43           argument is required and should be a "PPI::Token::Comment" that
44           conforms to the "## no critic" syntax.
45

METHODS

47       "disables_line( $line )"
48           Returns true if this Annotation disables $line for any (or all)
49           Policies.
50
51       "disables_policy( $policy_object )"
52       "disables_policy( $policy_name )"
53           Returns true if this Annotation disables $polciy_object or
54           $policy_name at any (or all) lines.
55
56       "disables_all_policies()"
57           Returns true if this Annotation disables all Policies at any (or
58           all) lines.  If this method returns true, "disabled_policies" will
59           return an empty list.
60
61       "effective_range()"
62           Returns a two-element list, representing the first and last line
63           numbers where this Annotation has effect.
64
65       "disabled_policies()"
66           Returns a list of the names of the Policies that are affected by
67           this Annotation.  If this list is empty, then it means that all
68           Policies are affected by this Annotation, and
69           "disables_all_policies()" should return true.
70
71       "element()"
72           Returns the PPI::Element where this annotation started.  This is
73           typically an instance of PPI::Token::Comment.
74

AUTHOR

76       Jeffrey Ryan Thalhammer <thaljef@cpan.org>
77
79       Copyright (c) 2005-2009 Jeffrey Ryan Thalhammer.  All rights reserved.
80
81       This program is free software; you can redistribute it and/or modify it
82       under the same terms as Perl itself.  The full text of this license can
83       be found in the LICENSE file included with this module.
84
85
86
87perl v5.12.1                      2010-09-08       Perl::Critic::Annotation(3)
Impressum