| 1 | package Data::Riak::Fast::HTTP::Response; | ||||||||||
| 2 | |||||||||||
| 3 | 22 | ▶ | use Mouse; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 22 | ▶ | use overload '""' => 'as_string', fallback => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 22 | my $_deconstruct_parts; | |||||||||
| 8 | |||||||||||
| 9 | has 'parts' => ( | ||||||||||
| 10 | is => 'ro', | ||||||||||
| 11 | isa => 'ArrayRef[HTTP::Message]', | ||||||||||
| 12 | lazy => 1, | ||||||||||
| 13 | 0 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | 0 | my $self = shift; | |||||||||
| 15 | 0 | my @parts = $_deconstruct_parts->( $self->http_response ); | |||||||||
| 16 | 0 | return \@parts; | |||||||||
| 17 | } | ||||||||||
| 18 | 22 | ); | |||||||||
| 19 | |||||||||||
| 20 | 22 | has 'http_response' => ( | |||||||||
| 21 | is => 'ro', | ||||||||||
| 22 | isa => 'HTTP::Response', | ||||||||||
| 23 | required => 1, | ||||||||||
| 24 | handles => { | ||||||||||
| 25 | code => 'code', | ||||||||||
| 26 | status_code => 'code', | ||||||||||
| 27 | message => 'content', | ||||||||||
| 28 | value => 'content', | ||||||||||
| 29 | is_success => 'is_success', | ||||||||||
| 30 | is_error => 'is_error', | ||||||||||
| 31 | as_string => 'as_string', | ||||||||||
| 32 | header => 'header', | ||||||||||
| 33 | headers => 'headers' | ||||||||||
| 34 | } | ||||||||||
| 35 | ); | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | $_deconstruct_parts = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 38 | 0 | my $message = shift; | |||||||||
| 39 | 0 | ▶ | return () unless $message->content; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | my @parts = $message->parts; | |||||||||
| 41 | 0 | ▶ | return $message unless @parts; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 0 | return map { $_deconstruct_parts->( $_ ) } @parts; | |||||||||
| 43 | 22 | }; | |||||||||
| 44 | |||||||||||
| 45 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||
| 46 | 22 | ▶ | no Mouse; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 47 | |||||||||||
| 48 | 22 | 1; | |||||||||
| 49 | |||||||||||
| 50 | __END__ | ||||||||||