File Coverage

lib/DataFlow/Proc/Encoding.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package DataFlow::Proc::Encoding;
2              
3 1     1   1591 use strict;
  1         1  
  1         31  
4 1     1   4 use warnings;
  1         2  
  1         33  
5              
6             # ABSTRACT: A encoding conversion processor
7              
8             our $VERSION = '1.121830'; # VERSION
9              
10 1     1   412 use Moose;
  0            
  0            
11             extends 'DataFlow::Proc';
12              
13             use DataFlow::Types qw(Encoder Decoder);
14              
15             use namespace::autoclean;
16             use MooseX::Aliases;
17              
18             has 'input_decoder' => (
19             'is' => 'ro',
20             'isa' => 'Decoder',
21             'coerce' => 1,
22             'lazy' => 1,
23             'builder' => '_build_encoder',
24             'alias' => 'from',
25             );
26              
27             sub _build_encoder {
28             return sub { $_[0] }
29             }
30              
31             has 'output_encoder' => (
32             'is' => 'ro',
33             'isa' => 'Encoder',
34             'coerce' => 1,
35             'lazy' => 1,
36             'builder' => '_build_decoder',
37             'alias' => 'to',
38             );
39              
40             sub _build_decoder {
41             return sub { $_[0] }
42             }
43              
44             sub _build_p {
45             my $self = shift;
46             return sub {
47             my $internal = $self->input_decoder->($_);
48             return $self->output_encoder->($internal);
49             };
50             }
51              
52             __PACKAGE__->meta->make_immutable;
53              
54             1;
55              
56              
57             __END__
58             =pod
59              
60             =encoding utf-8
61              
62             =head1 NAME
63              
64             DataFlow::Proc::Encoding - A encoding conversion processor
65              
66             =head1 VERSION
67              
68             version 1.121830
69              
70             =head1 SEE ALSO
71              
72             Please see those modules/websites for more information related to this module.
73              
74             =over 4
75              
76             =item *
77              
78             L<DataFlow|DataFlow>
79              
80             =back
81              
82             =head1 AUTHOR
83              
84             Alexei Znamensky <russoz@cpan.org>
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is copyright (c) 2011 by Alexei Znamensky.
89              
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92              
93             =head1 BUGS AND LIMITATIONS
94              
95             You can make new bug reports, and view existing ones, through the
96             web interface at L<http://rt.cpan.org>.
97              
98             =head1 DISCLAIMER OF WARRANTY
99              
100             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
101             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
102             WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
103             PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
104             EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
105             IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
106             PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
107             SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME
108             THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
109              
110             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
111             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
112             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
113             TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
114             CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
115             SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
116             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
117             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
118             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
119             DAMAGES.
120              
121             =cut
122