File Coverage

blib/lib/Net/HTTP/Spore/Middleware/Format/YAML.pm
Criterion Covered Total %
statement 8 10 80.0
branch n/a
condition n/a
subroutine 4 6 66.6
pod 4 4 100.0
total 16 20 80.0


line stmt bran cond sub pod time code
1             package Net::HTTP::Spore::Middleware::Format::YAML;
2             $Net::HTTP::Spore::Middleware::Format::YAML::VERSION = '0.08';
3             # ABSTRACT: middleware for YAML format
4              
5 1     1   776 use YAML;
  1         3  
  1         64  
6 1     1   6 use Moose;
  1         1  
  1         8  
7             extends 'Net::HTTP::Spore::Middleware::Format';
8              
9 0     0 1 0 sub encode { YAML::Decode( $_[1] ); }
10 1     1 1 6 sub decode { YAML::Load( $_[1] ); }
11 1     1 1 11 sub accept_type { ( 'Accept' => 'text/x-yaml' ) }
12 0     0 1   sub content_type { ( 'Content-Type' => 'text/x-yaml' ) }
13              
14             1;
15              
16             __END__
17              
18             =pod
19              
20             =encoding UTF-8
21              
22             =head1 NAME
23              
24             Net::HTTP::Spore::Middleware::Format::YAML - middleware for YAML format
25              
26             =head1 VERSION
27              
28             version 0.08
29              
30             =head1 SYNOPSIS
31              
32             my $client = Net::HTTP::Spore->new_from_spec('github.json');
33             $client->enable('Format::YAML');
34              
35             =head1 DESCRIPTION
36              
37             Net::HTTP::Spore::Middleware::Format::YAML is a simple middleware to handle the YAML format. It will set the appropriate B<Accept> header in your request. If the request method is PUT or POST, the B<Content-Type> header will also be set to YAML.
38              
39             This middleware will also deserialize content in the response. The deserialized content will be store in the B<body> of the response.
40              
41             =head1 EXAMPLES
42              
43             =head1 AUTHORS
44              
45             =over 4
46              
47             =item *
48              
49             Franck Cuny <franck.cuny@gmail.com>
50              
51             =item *
52              
53             Ash Berlin <ash@cpan.org>
54              
55             =item *
56              
57             Ahmad Fatoum <athreef@cpan.org>
58              
59             =back
60              
61             =head1 COPYRIGHT AND LICENSE
62              
63             This software is copyright (c) 2012 by Linkfluence.
64              
65             This is free software; you can redistribute it and/or modify it under
66             the same terms as the Perl 5 programming language system itself.
67              
68             =cut