NAME

Perl::Critic::TestUtils - Utility functions for testing new Policies

SYNOPSIS

use Perl::Critic::TestUtils qw(critique pcritique);

my $code = '<<END_CODE';
$foo = frobulator();
$baz = $foo ** 2;
END_CODE

# Critique code against all loaded policies...
my $perl_critic_config = { -severity => 2 };
my $violation_count = critique( $code, $perl_critic_config);

# Critique code against one policy...
my $custom_policy = 'Miscellanea::ProhibitFrobulation'
my $violation_count = pcritique( $code, $custom_policy );

DESCRIPTION

This module is not used directly by Perl::Critic but it provides a few handy subroutines for testing new Perl::Critic::Policy modules. Look at the test scripts that ship with Perl::Critic for more examples of how to use these subroutines.

EXPORTS

critique( $policy_name, $code_string_ref )
pcritique( $policy_name, $string_ref, $config_ref )
block_perlcriticrc()

AUTHOR

Chris Dolan <cdolan@cpan.org>

COPYRIGHT

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