File Coverage

blib/lib/Net/Amazon/EC2/Errors.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 18 19 94.7


line stmt bran cond sub pod time code
1             package Net::Amazon::EC2::Errors;
2 2     2   1123 use Moose;
  2         4  
  2         17  
3              
4             =head1 NAME
5              
6             Net::Amazon::EC2::Errors
7              
8             =head1 DESCRIPTION
9              
10             A class representing one or more errors from an API request.
11              
12             =head1 ATTRIBUTES
13              
14             =over
15              
16             =item request_id (required)
17              
18             The ID of the request associated with this error.
19              
20             =item errors (required)
21              
22             An array ref of Net::Amazon::EC2::Error objects associated with this request.
23              
24             =cut
25              
26 2     2   12810 use overload '""' => 'as_string';
  2         4  
  2         18  
27              
28             has 'request_id' => ( is => 'ro', isa => 'Str', required => 1 );
29             has 'errors' => (
30             is => 'rw',
31             isa => 'ArrayRef[Net::Amazon::EC2::Error]',
32             predicate => 'has_errors',
33             required => 1,
34             );
35              
36             sub as_string {
37 2     2 0 872 my $self = shift;
38 2         5 my $errors = join '', map { '['.$_->code.'] '.$_->message."\n" } @{$self->errors};
  2         71  
  2         79  
39 2         72 return "Amazon EC2 Errors [Request ".$self->request_id."]:\n$errors"
40             }
41              
42             __PACKAGE__->meta->make_immutable();
43              
44             =back
45              
46             =head1 AUTHOR
47              
48             Jeff Kim <cpan@chosec.com>
49              
50             =head1 COPYRIGHT
51              
52             Copyright (c) 2006-2010 Jeff Kim. This program is free software; you can redistribute it and/or modify it
53             under the same terms as Perl itself.
54              
55             =cut
56              
57 2     2   440 no Moose;
  2         4  
  2         12  
58             1;