File Coverage

blib/lib/Perl/ToPerl6/ThemeListing.pm
Criterion Covered Total %
statement 28 28 100.0
branch n/a
condition 1 2 50.0
subroutine 8 8 100.0
pod 2 2 100.0
total 39 40 97.5


line stmt bran cond sub pod time code
1             package Perl::ToPerl6::ThemeListing;
2              
3 1     1   476 use 5.006001;
  1         4  
4 1     1   4 use strict;
  1         1  
  1         25  
5 1     1   4 use warnings;
  1         4  
  1         30  
6              
7 1     1   3 use English qw<-no_match_vars>;
  1         1  
  1         7  
8              
9 1     1   359 use Perl::ToPerl6::Utils qw< hashify >;
  1         2  
  1         48  
10              
11 1     1   3 use overload ( q<""> => 'to_string' );
  1         1  
  1         8  
12              
13             our $VERSION = '0.03';
14              
15             #-----------------------------------------------------------------------------
16              
17             sub new {
18 1     1 1 19 my ($class, %args) = @_;
19              
20 1         4 my $self = bless {}, $class;
21              
22 1   50     41 $self->{_transformers} = $args{-transformers} || [];
23              
24 1         5 return $self;
25             }
26              
27             #-----------------------------------------------------------------------------
28              
29             sub to_string {
30 1     1 1 8 my ($self) = @_;
31              
32 1         2 my %themes;
33 1         2 foreach my $transformer ( @{ $self->{_transformers} } ) {
  1         3  
34 38         202 my @themes = $transformer->get_themes();
35 38         87 @themes{ @themes } = @themes;
36             }
37              
38 1         10 return join ("\n", sort keys %themes) . "\n";
39             }
40              
41             #-----------------------------------------------------------------------------
42              
43             1;
44              
45             __END__
46              
47             =pod
48              
49             =head1 NAME
50              
51             Perl::ToPerl6::ThemeListing - List the themes of the installed Transformers.
52              
53              
54             =head1 DESCRIPTION
55              
56             This is a helper class that gathers the themes of the installed
57             Transformers. There are no user-serviceable parts here.
58              
59              
60             =head1 INTERFACE SUPPORT
61              
62             This is considered to be a non-public class. Its interface is subject
63             to change without notice.
64              
65              
66             =head1 CONSTRUCTOR
67              
68             =over
69              
70             =item C<< new( -transformers => \@POLICY_OBJECTS ) >>
71              
72             Returns a reference to a new C<Perl::ToPerl6::ThemeListing> object.
73              
74              
75             =back
76              
77              
78             =head1 METHODS
79              
80             =over
81              
82              
83             =item to_string()
84              
85             Returns a string representation of this C<ThemeListing>. See
86             L<"OVERLOADS"> for more information.
87              
88              
89             =back
90              
91              
92             =head1 OVERLOADS
93              
94              
95             When a L<Perl::ToPerl6::ThemeListing|Perl::ToPerl6::ThemeListing> is
96             evaluated in string context, it produces a one-line summary of the
97             default severity, transformer name, and default themes for each
98             L<Perl::ToPerl6::Transformer|Perl::ToPerl6::Transformer> object that was given to
99             the constructor of this C<ThemeListing>.
100              
101              
102             =head1 AUTHOR
103              
104             Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
105              
106              
107             =head1 COPYRIGHT
108              
109             Copyright (c) 2005-2011 Imaginative Software Systems. 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 :