Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / lib / Perl / Critic / ThemeListing.pm
1 ##############################################################################
2 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/ThemeListing.pm $
3 #     $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $
4 #   $Author: clonezone $
5 # $Revision: 2489 $
6 ##############################################################################
7
8 package Perl::Critic::ThemeListing;
9
10 use 5.006001;
11 use strict;
12 use warnings;
13
14 use English qw<-no_match_vars>;
15
16 use Perl::Critic::Utils qw< hashify >;
17
18 use overload ( q<""> => 'to_string' );
19
20 our $VERSION = '1.088';
21
22 #-----------------------------------------------------------------------------
23
24 sub new {
25     my ($class, %args) = @_;
26
27     my $self = bless {}, $class;
28
29     $self->{_policies} = $args{-policies} || [];
30
31     return $self;
32 }
33
34 #-----------------------------------------------------------------------------
35
36 sub to_string {
37     my ($self) = @_;
38
39     my %themes;
40     foreach my $policy ( @{ $self->{_policies} } ) {
41         my @themes = $policy->get_themes();
42         @themes{ @themes } = @themes;
43     }
44
45     return join ("\n", sort keys %themes) . "\n";
46 }
47
48 #-----------------------------------------------------------------------------
49
50 1;
51
52 __END__
53
54 =pod
55
56 =head1 NAME
57
58 Perl::Critic::ThemeListing - List the themes of the installed Policies.
59
60
61 =head1 DESCRIPTION
62
63 This is a helper class that gathers the themes of the installed
64 Policies.  There are no user-serviceable parts here.
65
66
67 =head1 CONSTRUCTOR
68
69 =over
70
71 =item C<< new( -policies => \@POLICY_OBJECTS ) >>
72
73 Returns a reference to a new C<Perl::Critic::ThemeListing> object.
74
75
76 =back
77
78
79 =head1 METHODS
80
81 =over
82
83
84 =item to_string()
85
86 Returns a string representation of this C<ThemeListing>.  See
87 L<"OVERLOADS"> for more information.
88
89
90 =back
91
92
93 =head1 OVERLOADS
94
95
96 When a L<Perl::Critic::ThemeListing> is evaluated in string context,
97 it produces a one-line summary of the default severity, policy name,
98 and default themes for each L<Perl::Critic::Policy> object that was
99 given to the constructor of this C<ThemeListing>.
100
101
102 =head1 AUTHOR
103
104 Jeffrey Ryan Thalhammer <thaljef@cpan.org>
105
106
107 =head1 COPYRIGHT
108
109 Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer.  All rights reserved.
110
111 This program is free software; you can redistribute it and/or modify
112 it under the same terms as Perl itself.  The full text of this license
113 can be found in the LICENSE file included with this module.
114
115 =cut
116
117 # Local Variables:
118 #   mode: cperl
119 #   cperl-indent-level: 4
120 #   fill-column: 78
121 #   indent-tabs-mode: nil
122 #   c-indentation-style: bsd
123 # End:
124 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :