| 1 | package Paws::API::Base64Attribute; | ||||||||||
| 2 | 35 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 35 | Moose::Util::meta_attribute_alias('Base64Attribute'); | |||||||||
| 4 | |||||||||||
| 5 | 35 | has method => (is => 'rw', isa => 'Str', required => 1); | |||||||||
| 6 | 35 | has decode_as => (is => 'rw', isa => 'Str', required => 1); | |||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | after 'install_accessors' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 9 | 0 | my $self = shift; | |||||||||
| 10 | 0 | my $realclass = $self->associated_class(); | |||||||||
| 11 | 0 | my $closure = $self->name; | |||||||||
| 12 | 0 | my $coderef; | |||||||||
| 13 | 0 | ▶ | if ($self->decode_as eq 'Base64') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | ▶ | $coderef = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 15 | 0 | my ($orig, $self) = @_; | |||||||||
| 16 | 0 | require MIME::Base64; | |||||||||
| 17 | 0 | return MIME::Base64::decode($self->$orig()); | |||||||||
| 18 | 0 | }; | |||||||||
| 19 | 0 | $realclass->add_around_method_modifier( $self->method => $coderef ); | |||||||||
| 20 | } else { | ||||||||||
| 21 | 0 | die "Unrecognized Base64Attribute decode_as attribute"; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 35 | }; | |||||||||
| 25 | 35 | 1; | |||||||||