File Coverage

blib/lib/Data/AMF/Formatter.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 23 25 92.0


line stmt bran cond sub pod time code
1             package Data::AMF::Formatter;
2 7     7   45 use strict;
  7         13  
  7         278  
3 7     7   43 use warnings;
  7         15  
  7         212  
4              
5 7     7   4044 use Data::AMF::Formatter::AMF0;
  7         587  
  7         56  
6 7     7   4639 use Data::AMF::Formatter::AMF3;
  7         27  
  7         103  
7              
8             sub new {
9 1     1 1 2 my $class = shift;
10 1 50       8 my $args = @_ > 1 ? {@_} : $_[0];
11            
12 1 50       21 return $args->{version} == 3
13             ? 'Data::AMF::Formatter::AMF3'
14             : 'Data::AMF::Formatter::AMF0';
15             }
16              
17             =head1 NAME
18            
19             Data::AMF::Formatter - serializer proxy class
20              
21             =head1 SYNOPSIS
22              
23             my $amf3_formatter_class = Data::AMF::Formatter->new( version => 3 );
24             my $amf0_formatter_class = Data::AMF::Formatter->new( version => 0 ); # or just new without option
25              
26             =head1 METHODS
27              
28             =head2 new
29              
30             =head1 AUTHOR
31              
32             Daisuke Murase
33              
34             =head1 COPYRIGHT
35              
36             This program is free software; you can redistribute
37             it and/or modify it under the same terms as Perl itself.
38              
39             The full text of the license can be found in the
40             LICENSE file included with this module.
41              
42             =cut
43              
44             1;