1 #!perl ## no critic (PodSpelling)
2 ##############################################################################
3 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/PolicySummary.pod.PL $
4 # $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $
7 ##############################################################################
9 # TODO: The "no critic" above is due to PodSpelling not being able to tell
10 # that there is no POD in this program.
18 use English qw< -no_match_vars >;
19 use Carp qw< confess >;
21 # We need both because the blib directory may or may not be in @INC at the
23 use lib qw< blib lib >;
25 use Perl::Critic::Config;
26 use Perl::Critic::Exception::IO ();
27 use Perl::Critic::PolicyFactory (-test => 1);
28 use Perl::Critic::Utils qw< :characters >;
29 use Perl::Critic::Utils::POD qw< get_module_abstract_from_file >;
31 use Exception::Class (); # Must be after P::C::Exception::*
33 our $VERSION = '1.088';
36 print "\n\nGenerating Perl::Critic::PolicySummary.\n";
40 Perl::Critic::Config->new(
45 my @policies = $configuration->policies();
48 my $policy_summary = 'lib/Perl/Critic/PolicySummary.pod';
50 ## no critic (RequireBriefOpen)
51 open my $pod_file, '>', $policy_summary
52 or confess "Could not open $policy_summary: $ERRNO";
54 print {$pod_file} <<'END_HEADER';
57 Perl::Critic::PolicySummary - Descriptions of the Policy modules included with L<Perl::Critic> itself.
62 The following Policy modules are distributed with Perl::Critic.
63 (There are additional Policies that can be found in add-on
64 distributions.) The Policy modules have been categorized according to
65 the table of contents in Damian Conway's book B<Perl Best Practices>.
66 Since most coding standards take the form "do this..." or "don't do
67 that...", I have adopted the convention of naming each module
68 C<RequireSomething> or C<ProhibitSomething>. Each Policy is listed
69 here with its default severity. If you don't agree with the default
70 severity, you can change it in your F<.perlcriticrc> file. See the
71 documentation of each module for its specific details.
79 my $format = <<'END_POLICY';
87 foreach my $policy (@policies) {
88 my $module_abstract = $policy->get_raw_abstract();
93 $policy->get_long_name(),
95 $policy->default_severity();
101 # Yes, an assignment and not equality test.
102 if (my $exception = $EVAL_ERROR) {
103 if ( ref $exception ) {
104 $exception->show_trace(1);
107 print {*STDERR} "$exception\n";
110 print {*STDERR} "Failed printing abstracts for an unknown reason.\n";
117 print {$pod_file} <<'END_FOOTER';
121 This is part of L<Perl::Critic> version 1.088.
126 Jeffrey Ryan Thalhammer <thaljef@cpan.org>
130 Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. All rights reserved.
132 This program is free software; you can redistribute it and/or modify
133 it under the same terms as Perl itself. The full text of this license
134 can be found in the LICENSE file included with this module.
140 close $pod_file or confess "Could not close $policy_summary: $ERRNO";
146 ##############################################################################
149 # cperl-indent-level: 4
151 # indent-tabs-mode: nil
152 # c-indentation-style: bsd
154 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :