File Coverage

blib/lib/Net/Amazon/S3/X.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 19 20 95.0


line stmt bran cond sub pod time code
1             package Net::Amazon::S3::X;
2             $Net::Amazon::S3::X::VERSION = '0.98';
3             # ABSTRACT: Net::Amazon::S3 exceptions
4              
5 1     1   1252 use Moose;
  1         2  
  1         10  
6 1     1   7496 use Moose::Meta::Class;
  1         3  
  1         192  
7              
8             has request => (
9             is => 'ro',
10             );
11              
12             has response => (
13             is => 'ro',
14             handles => [
15             'error_code',
16             'error_message',
17             'http_response',
18             ],
19             );
20              
21             my %exception_map;
22             sub import {
23 12     12   39 my ($class, @exceptions) = @_;
24              
25 12         186 for my $exception (@exceptions) {
26 10 100       55 next if exists $exception_map{$exception};
27             Moose::Meta::Class->create (
28 5         63 $exception_map{$exception} = __PACKAGE__ . "::$exception",
29             superclasses => [ __PACKAGE__ ],
30             );
31             }
32             }
33              
34             sub build {
35 10     10 0 4311 my ($self, $exception, @params) = @_;
36              
37 10         52 $self->import ($exception);
38              
39 10         14519 $exception_map{$exception}->new (@params);
40             }
41              
42             1;
43              
44             __END__
45              
46             =pod
47              
48             =encoding UTF-8
49              
50             =head1 NAME
51              
52             Net::Amazon::S3::X - Net::Amazon::S3 exceptions
53              
54             =head1 VERSION
55              
56             version 0.98
57              
58             =head1 AUTHOR
59              
60             Branislav ZahradnĂ­k <barney@cpan.org>
61              
62             =head1 COPYRIGHT AND LICENSE
63              
64             This software is copyright (c) 2021 by Amazon Digital Services, Leon Brocard, Brad Fitzpatrick, Pedro Figueiredo, Rusty Conover, Branislav ZahradnĂ­k.
65              
66             This is free software; you can redistribute it and/or modify it under
67             the same terms as the Perl 5 programming language system itself.
68              
69             =cut