File Coverage

blib/lib/Perl/ToPerl6/TransformerListing.pm
Criterion Covered Total %
statement 23 29 79.3
branch n/a
condition 1 2 50.0
subroutine 7 9 77.7
pod 2 2 100.0
total 33 42 78.5


line stmt bran cond sub pod time code
1             package Perl::ToPerl6::TransformerListing;
2              
3 1     1   1233 use 5.006001;
  1         6  
4 1     1   6 use strict;
  1         2  
  1         29  
5 1     1   5 use warnings;
  1         2  
  1         37  
6              
7 1     1   5 use English qw(-no_match_vars);
  1         2  
  1         10  
8              
9 1     1   460 use Perl::ToPerl6::Transformer qw();
  1         3  
  1         21  
10              
11 1     1   5 use overload ( q<""> => 'to_string' );
  1         3  
  1         7  
12              
13             #-----------------------------------------------------------------------------
14              
15             sub new {
16 1     1 1 1348 my ($class, %args) = @_;
17              
18 1         2 my $self = bless {}, $class;
19              
20 1   50     9 my $transformers = $args{-transformers} || [];
21 1         3 $self->{_transformers} = [ sort _by_type @{ $transformers } ];
  1         30  
22              
23 1         10 return $self;
24             }
25              
26             #-----------------------------------------------------------------------------
27              
28             sub to_string {
29 0     0 1   my ($self) = @_;
30              
31 0           Perl::ToPerl6::Transformer::set_format( "%s %p [%t]\n" );
32              
33 0           return join q{}, map { "$_" } @{ $self->{_transformers} };
  0            
  0            
34             }
35              
36             #-----------------------------------------------------------------------------
37              
38 0     0     sub _by_type { return ref $a cmp ref $b }
39              
40             1;
41              
42             __END__
43              
44             =pod
45              
46             =head1 NAME
47              
48             Perl::ToPerl6::TransformerListing - Display minimal information about Transformers.
49              
50              
51             =head1 DESCRIPTION
52              
53             This is a helper class that formats a set of Transformer objects for
54             pretty-printing. There are no user-serviceable parts here.
55              
56              
57             =head1 INTERFACE SUPPORT
58              
59             This is considered to be a non-public class. Its interface is subject
60             to change without notice.
61              
62              
63             =head1 CONSTRUCTOR
64              
65             =over
66              
67             =item C<< new( -transformers => \@TRANSFORMER_OBJECTS ) >>
68              
69             Returns a reference to a new C<Perl::ToPerl6::TransformerListing> object.
70              
71              
72             =back
73              
74              
75             =head1 METHODS
76              
77             =over
78              
79             =item to_string()
80              
81             Returns a string representation of this C<TransformerListing>. See
82             L<"OVERLOADS"> for more information.
83              
84              
85             =back
86              
87              
88             =head1 OVERLOADS
89              
90             When a L<Perl::ToPerl6::TransformerListing|Perl::ToPerl6::TransformerListing> is
91             evaluated in string context, it produces a one-line summary of the
92             default necessity, transformer name, and default themes for each
93             L<Perl::ToPerl6::Transformer|Perl::ToPerl6::Transformer> object that was given to
94             the constructor of this C<TransformerListing>.
95              
96              
97             =head1 AUTHOR
98              
99             Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
100              
101              
102             =head1 COPYRIGHT
103              
104             Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
105              
106             This program is free software; you can redistribute it and/or modify
107             it under the same terms as Perl itself. The full text of this license
108             can be found in the LICENSE file included with this module.
109              
110             =cut
111              
112             # Local Variables:
113             # mode: cperl
114             # cperl-indent-level: 4
115             # fill-column: 78
116             # indent-tabs-mode: nil
117             # c-indentation-style: bsd
118             # End:
119             # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :