File Coverage

blib/lib/WWW/Snooze/Serialize.pm
Criterion Covered Total %
statement 9 15 60.0
branch n/a
condition n/a
subroutine 3 7 42.8
pod 5 5 100.0
total 17 27 62.9


line stmt bran cond sub pod time code
1             package WWW::Snooze::Serialize;
2              
3 3     3   18 use strict;
  3         6  
  3         92  
4 3     3   13 use warnings;
  3         6  
  3         788  
5              
6             sub new {
7 0     0 1 0 my $class = shift;
8 0         0 my %args = @_;
9              
10 0         0 bless {
11             extension => '',
12             content_type => '',
13             %args
14             }, $class;
15             }
16              
17 0     0 1 0 sub encode { return {}; }
18 0     0 1 0 sub decode { return {}; }
19              
20 0     0 1 0 sub content_type { shift->{content_type}; }
21              
22             sub extension {
23 6     6 1 18 my $ext = shift->{extension};
24 6         45 $ext =~ s/^(\w+)$/.$1/;
25 6         34 return $ext;
26             }
27              
28             1;
29             =head1 NAME
30              
31             WWW::Snooze::Serialize - Base object for building serializers
32              
33             =head1 METHODS
34              
35              
36             =head2 new(%args)
37              
38             =over 4
39              
40             =item extension
41              
42             Set filename extension
43              
44             =item content_type
45              
46             Set MIME type on request
47              
48             =back
49              
50              
51             =head2 encode()
52              
53             =head2 decode()
54              
55             Functions for overriding encoding and decoding of request/response data
56              
57              
58             =head2 extension()
59              
60             Return the extension, prepended with '.'
61              
62              
63             =head1 AUTHOR
64              
65             Anthony Johnson Eaj@ohess.orgE
66              
67             =cut