| 1 | package Flickr::API::Response; | ||||||||||
| 2 | |||||||||||
| 3 | 15 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 15 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 15 | ▶ | use HTTP::Response; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 15 | ▶ | use parent qw(HTTP::Response); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 15 | our $VERSION = '1.28'; | |||||||||
| 10 | |||||||||||
| 11 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 12 | 0 | my $class = shift; | |||||||||
| 13 | 0 | my $self = HTTP::Response->new; | |||||||||
| 14 | 0 | my $options = shift; | |||||||||
| 15 | 0 | bless $self, $class; | |||||||||
| 16 | 0 | return $self; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 2 | ▶ | sub init_flickr { | ||||||||
|
Subroutine
init_flickr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 20 | 2 | my ($self, $options) = @_; | |||||||||
| 21 | 2 | $self->{tree} = undef; | |||||||||
| 22 | 2 | $self->{hash} = undef; | |||||||||
| 23 | 2 | $self->{success} = 0; | |||||||||
| 24 | 2 | $self->{error_code} = 0; | |||||||||
| 25 | 2 | $self->{error_message} = ''; | |||||||||
| 26 | 2 | return; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 2 | ▶ | sub set_fail { | ||||||||
|
Subroutine
set_fail: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | 2 | my ($self, $code, $message) = @_; | |||||||||
| 31 | 2 | $self->{success} = 0; | |||||||||
| 32 | 2 | $self->{error_code} = $code; | |||||||||
| 33 | 2 | $self->{error_message} = $message; | |||||||||
| 34 | 2 | return; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | sub set_ok { | ||||||||
|
Subroutine
set_ok: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 38 | 0 | my ($self, $tree, $hashref) = @_; | |||||||||
| 39 | 0 | $self->{success} = 1; | |||||||||
| 40 | 0 | $self->{tree} = $tree; | |||||||||
| 41 | 0 | $self->{hash} = $hashref; | |||||||||
| 42 | 0 | return; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | # | ||||||||||
| 46 | # some accessors | ||||||||||
| 47 | # | ||||||||||
| 48 | 0 | ▶ | sub as_tree { | ||||||||
|
Subroutine
as_tree: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 49 | 0 | my ($self) = @_; | |||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | if (defined $self->{tree}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | |||||||||||
| 53 | 0 | return $self->{tree}; | |||||||||
| 54 | } | ||||||||||
| 55 | else { | ||||||||||
| 56 | 0 | return; | |||||||||
| 57 | } | ||||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | sub as_hash { | ||||||||
|
Subroutine
as_hash: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 62 | 0 | my ($self) = @_; | |||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | if (defined $self->{hash}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | |||||||||||
| 66 | 0 | return $self->{hash}; | |||||||||
| 67 | } | ||||||||||
| 68 | else { | ||||||||||
| 69 | 0 | return; | |||||||||
| 70 | } | ||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 3 | ▶ | sub error_code { | ||||||||
|
Subroutine
error_code: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 74 | |||||||||||
| 75 | 3 | my ($self) = @_; | |||||||||
| 76 | 3 | return $self->{error_code}; | |||||||||
| 77 | |||||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 1 | ▶ | sub error_message { | ||||||||
|
Subroutine
error_message: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 81 | |||||||||||
| 82 | 1 | my ($self) = @_; | |||||||||
| 83 | 1 | my $text = $self->{error_message}; | |||||||||
| 84 | 1 | $text =~ s/\"/\"/g; | |||||||||
| 85 | 1 | return $text; | |||||||||
| 86 | |||||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | 1 | ▶ | sub success { | ||||||||
|
Subroutine
success: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 90 | |||||||||||
| 91 | 1 | my ($self) = @_; | |||||||||
| 92 | 1 | return $self->{success}; | |||||||||
| 93 | |||||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 3 | ▶ | sub rc { | ||||||||
|
Subroutine
rc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 97 | |||||||||||
| 98 | 3 | my ($self) = @_; | |||||||||
| 99 | 3 | return $self->{_rc}; | |||||||||
| 100 | |||||||||||
| 101 | } | ||||||||||
| 102 | |||||||||||
| 103 | 1 | ▶ | sub _propagate_status { | ||||||||
|
Subroutine
_propagate_status: called CC=1 SCAR=0.0
| |||||||||||
| 104 | |||||||||||
| 105 | 1 | my $self = shift; | |||||||||
| 106 | 1 | my $stat = shift; | |||||||||
| 107 | |||||||||||
| 108 | 1 | $stat->{_rc} = $self->{_rc}; # http response _rc | |||||||||
| 109 | 1 | $stat->{success} = $self->{success}; # set by Flickr::API::Response | |||||||||
| 110 | 1 | $stat->{error_code} = $self->{error_code}; # Returned by Flickr or set in API | |||||||||
| 111 | 1 | $stat->{error_message} = $self->error_message(); # use method since it fixes text | |||||||||
| 112 | |||||||||||
| 113 | 1 | return; | |||||||||
| 114 | |||||||||||
| 115 | } | ||||||||||
| 116 | |||||||||||
| 117 | 15 | 1; | |||||||||
| 118 | |||||||||||
| 119 | __END__ | ||||||||||