File Coverage

blib/lib/Paws/API/Base64Attribute.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Paws::API::Base64Attribute;
2 22     22   126 use Moose::Role;
  22         45  
  22         353  
3             Moose::Util::meta_attribute_alias('Base64Attribute');
4              
5             has method => (is => 'rw', isa => 'Str', required => 1);
6             has decode_as => (is => 'rw', isa => 'Str', required => 1);
7              
8             after 'install_accessors' => sub {
9             my $self = shift;
10             my $realclass = $self->associated_class();
11             my $closure = $self->name;
12             my $coderef;
13             if ($self->decode_as eq 'Base64') {
14             $coderef = sub {
15             my ($orig, $self) = @_;
16             require MIME::Base64;
17             return MIME::Base64::decode($self->$orig());
18             };
19             $realclass->add_around_method_modifier( $self->method => $coderef );
20             } else {
21             die "Unrecognized Base64Attribute decode_as attribute";
22             }
23              
24             };
25             1;