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::Policy - Base class for Policy modules

DESCRIPTION

Perl::Critic::Policy is the abstract base class for all Policy objects. Your job is to implement and override its methods in a subclass. To work with the Perl::Critic engine, your implementation must behave as described below.

METHODS

new(key1 => value1, key2 => value2...)

Returns a reference to a new subclass of Perl::Critic::Policy. If your Policy requires any special arguments, they should be passed in here as key-value paris. Users of perlcritic can specify these in their config file. Unless you override the new method, the default method simply returns a reference to an empty hash that has been blessed into your subclass.

violations( $doc )

Given a PPI::Document or PPI::DocumentFragment, returns a list of Perl::Critic::Violation objects for each violation of the policy. If there are no violations, then it returns an empty list. This is an abstract method and it will croak if you attempt to invoke it directly. Your subclass must override this method.

AUTHOR

Jeffrey Ryan Thalhammer <thaljef@cpan.org>

COPYRIGHT

Copyright (c) 2005 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.