File Coverage

blib/lib/HTTP/Throwable/JSONFactory.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package HTTP::Throwable::JSONFactory;
2             # ABSTRACT: Throw exceptions with JSON bodies
3             $HTTP::Throwable::JSONFactory::VERSION = '0.001';
4 1     1   25532 use strict;
  1         1  
  1         22  
5 1     1   3 use warnings;
  1         1  
  1         20  
6              
7 1     1   385 use parent qw(HTTP::Throwable::Factory);
  1         878  
  1         5  
8              
9             sub extra_roles {
10 1     1 1 104309 return qw(
11             HTTP::Throwable::Role::JSONBody
12             );
13             }
14              
15             1;
16              
17             =pod
18              
19             =encoding UTF-8
20              
21             =head1 NAME
22              
23             HTTP::Throwable::JSONFactory - Throw exceptions with JSON bodies
24              
25             =head1 VERSION
26              
27             version 0.001
28              
29             =head1 SYNOPSIS
30              
31             use HTTP::Throwable::JSONFactory qw(http_throw);
32              
33             http_throw(Gone => {
34             payload => {
35             error => "You won't find what you're looking for here",
36             },
37             });
38              
39             =head1 OVERVIEW
40              
41             This subclass of L arranges for each built/thrown
42             exception to consume the L role, which
43             will generate HTTP responses with an C content type and
44             encode the provided payload using L.
45              
46             The C attribute passed to C or C should
47             be anything allowed by L (hashref, arrayref, etc).
48              
49             =head1 AUTHOR
50              
51             Matthew Horsfall
52              
53             =head1 COPYRIGHT AND LICENSE
54              
55             This software is copyright (c) 2016 by Matthew Horsfall.
56              
57             This is free software; you can redistribute it and/or modify it under
58             the same terms as the Perl 5 programming language system itself.
59              
60             =cut
61              
62             __END__