1 ##############################################################################
2 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/PolicyListing.pm $
3 # $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $
6 ##############################################################################
8 package Perl::Critic::PolicyListing;
14 use English qw(-no_match_vars);
16 use Perl::Critic::Policy qw();
18 use overload ( q<""> => 'to_string' );
20 our $VERSION = '1.088';
22 #-----------------------------------------------------------------------------
25 my ($class, %args) = @_;
27 my $self = bless {}, $class;
29 my $policies = $args{-policies} || [];
30 $self->{_policies} = [ sort _by_type @{ $policies } ];
35 #-----------------------------------------------------------------------------
40 Perl::Critic::Policy::set_format( "%s %p [%t]\n" );
42 return join q{}, map { "$_" } @{ $self->{_policies} };
45 #-----------------------------------------------------------------------------
47 sub _by_type { return ref $a cmp ref $b }
57 Perl::Critic::PolicyListing - Display minimal information about Policies.
61 This is a helper class that formats a set of Policy objects for
62 pretty-printing. There are no user-serviceable parts here.
68 =item C<< new( -policies => \@POLICY_OBJECTS ) >>
70 Returns a reference to a new C<Perl::Critic::PolicyListing> object.
80 Returns a string representation of this C<PolicyListing>. See
81 L<"OVERLOADS"> for more information.
87 When a L<Perl::Critic::PolicyListing> is evaluated in string context,
88 it produces a one-line summary of the default severity, policy name,
89 and default themes for each L<Perl::Critic::Policy> object that was
90 given to the constructor of this C<PolicyListing>.
94 Jeffrey Ryan Thalhammer <thaljef@cpan.org>
98 Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. All rights reserved.
100 This program is free software; you can redistribute it and/or modify
101 it under the same terms as Perl itself. The full text of this license
102 can be found in the LICENSE file included with this module.
108 # cperl-indent-level: 4
110 # indent-tabs-mode: nil
111 # c-indentation-style: bsd
113 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :