| 1 | package Net::FireEagle; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # Client library for FireEagle | ||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use base qw(Net::OAuth::Simple); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 3 | our $VERSION = '1.6'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # FireEagle Endpoint URLs | ||||||||||||||||||||||||||||
| 10 | 3 | our $REQUEST_TOKEN_URL = 'https://fireeagle.yahooapis.com/oauth/request_token'; | |||||||||||||||||||||||||||
| 11 | 3 | our $AUTHORIZATION_URL = 'https://fireeagle.yahoo.net/oauth/authorize'; | |||||||||||||||||||||||||||
| 12 | 3 | our $ACCESS_TOKEN_URL = 'https://fireeagle.yahooapis.com/oauth/access_token'; | |||||||||||||||||||||||||||
| 13 | 3 | our $QUERY_API_URL = 'https://fireeagle.yahooapis.com/api/0.1/user'; | |||||||||||||||||||||||||||
| 14 | 3 | our $UPDATE_API_URL = 'https://fireeagle.yahooapis.com/api/0.1/update'; | |||||||||||||||||||||||||||
| 15 | 3 | our $LOOKUP_API_URL = 'https://fireeagle.yahooapis.com/api/0.1/lookup'; | |||||||||||||||||||||||||||
| 16 | 3 | our $WITHIN_API_URL = 'https://fireeagle.yahooapis.com/api/0.1/within'; | |||||||||||||||||||||||||||
| 17 | 3 | our $RECENT_API_URL = 'https://fireeagle.yahooapis.com/api/0.1/recent'; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =head1 NAME | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | Net::FireEagle - access Yahoo's new FireEagle location service | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # Set up Fire Eagle oauth | ||||||||||||||||||||||||||||
| 27 | my $fe = Net::FireEagle->new( consumer_key => $consumer_key, | ||||||||||||||||||||||||||||
| 28 | consumer_secret => $consumer_secret ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # Resume previous Fire Eagle oauth, feed access token and secret | ||||||||||||||||||||||||||||
| 31 | my $fe2 = Net::FireEagle->new( consumer_key => $consumer_key, | ||||||||||||||||||||||||||||
| 32 | consumer_secret => $consumer_secret, | ||||||||||||||||||||||||||||
| 33 | access_token => $access_token, | ||||||||||||||||||||||||||||
| 34 | access_token_secret => $access_token_secret ); | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | # Send this to user to grant authorization for this app | ||||||||||||||||||||||||||||
| 37 | my $auth_url = $fe->get_authorization_url; | ||||||||||||||||||||||||||||
| 38 | # ... and request an access token | ||||||||||||||||||||||||||||
| 39 | # Note: you can save these in DB to restore previous Fire Eagle oauth session | ||||||||||||||||||||||||||||
| 40 | my ($access_token, $access_token_secret) = $fe->request_access_token; | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | # Get them back | ||||||||||||||||||||||||||||
| 43 | my $access_token = $fe->access_token; | ||||||||||||||||||||||||||||
| 44 | my $access_token_secret = $fe->access_token_secret; | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # in the case of a web app, you want to save the request tokens | ||||||||||||||||||||||||||||
| 47 | # (and/or set them) | ||||||||||||||||||||||||||||
| 48 | my $request_token = $fe->request_token; | ||||||||||||||||||||||||||||
| 49 | my $request_token_secret = $fe->request_token_secret; | ||||||||||||||||||||||||||||
| 50 | $fe->request_token( $request_token ); | ||||||||||||||||||||||||||||
| 51 | $fe->request_token_secret( $request_token_secret ); | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | # Can't query or update location without authorization | ||||||||||||||||||||||||||||
| 54 | my $loc = $fe->location; # returns xml | ||||||||||||||||||||||||||||
| 55 | my $loc = $fe->location( format => 'xml' ); # returns xml | ||||||||||||||||||||||||||||
| 56 | my $loc = $fe->location( format => 'json' ); # returns json | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # returns result on success. dies or returns undef on failure | ||||||||||||||||||||||||||||
| 59 | my $return = $fe->update_location( "500 Third St., San Francisco, CA" ); | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | # Find a location. Returns either xml or json | ||||||||||||||||||||||||||||
| 62 | my $return = $fe->lookup_location( "Pensacola" ); | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head1 ABOUT | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | Fire Eagle is a site that stores information about your location. With | ||||||||||||||||||||||||||||
| 67 | your permission, other services and devices can either update that | ||||||||||||||||||||||||||||
| 68 | information or access it. By helping applications respond to your | ||||||||||||||||||||||||||||
| 69 | location, Fire Eagle is designed to make the world around you more | ||||||||||||||||||||||||||||
| 70 | interesting! Use your location to power friend-finders, games, local | ||||||||||||||||||||||||||||
| 71 | information services, blog badges and stuff like that... | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | For more information see http://fireeagle.yahoo.net/ | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =head1 AUTHENTICATION | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | For more information read this | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | http://fireeagle.yahoo.net/developer/documentation/getting_started | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | but, in short you have to first get an API key from the FireEagle site. | ||||||||||||||||||||||||||||
| 82 | Then using this consumer key and consumer secret you have to | ||||||||||||||||||||||||||||
| 83 | authenticate the relationship between you and your user. See the script | ||||||||||||||||||||||||||||
| 84 | C<fireagle> packaged with this module for an example of how to do this. | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =head1 SIMPLE DAILY USAGE AND EXAMPLE CODE | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | The script C<fireeagle> shipped with this module gives you really | ||||||||||||||||||||||||||||
| 89 | quick access to your FireEagle account - you can use it to simply | ||||||||||||||||||||||||||||
| 90 | query and update your location. | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | It also serves as a pretty good example of how to do desktop app | ||||||||||||||||||||||||||||
| 93 | authentication and how to use the API. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =head1 METHODS | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | =cut | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =head2 new <opts> | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | Create a new FireEagle object. This must have the options | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | =over 4 | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =item consumer_key | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =item consumer_secret | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =back | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | which you can get at http://fireeagle.yahoo.net/developer/manage | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | then, when you have your per-user authentication tokens (see above) you | ||||||||||||||||||||||||||||
| 114 | can supply | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =over 4 | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | =item access_token | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =item access_token_secret | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =back | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | Alternatively when you create a new web-based application, a general-purpose | ||||||||||||||||||||||||||||
| 125 | access token is issued to you along with your application key and secret. You | ||||||||||||||||||||||||||||
| 126 | can get them at http://fireeagle.yahoo.net/developer/manage. | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | They are tied to your application and allow your application to make | ||||||||||||||||||||||||||||
| 129 | general-purpose API method calls (often batch-style) to Fire Eagle. | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | You can read about them at | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | http://fireagle.yahoo.net/developer/documentation/using_oauth#feaccesstokens | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | You can pass them in using the param | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | =over 4 | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =item general_token | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =item general_token_secret | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | =back | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =cut | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 150 | 1 | my $proto = shift; | |||||||||||||||||||||||||||
| 151 | 1 | ▶ | my $class = ref $proto || $proto; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||
| 152 | 1 | my %tokens = @_; | |||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 1 | return $class->SUPER::new( tokens => \%tokens, | |||||||||||||||||||||||||||
| 155 | urls => { | ||||||||||||||||||||||||||||
| 156 | authorization_url => $AUTHORIZATION_URL, | ||||||||||||||||||||||||||||
| 157 | request_token_url => $REQUEST_TOKEN_URL, | ||||||||||||||||||||||||||||
| 158 | access_token_url => $ACCESS_TOKEN_URL, | ||||||||||||||||||||||||||||
| 159 | }); | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | =head2 location [opt[s] | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | Get the user's current location. | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | Options are passed in as a hash and may be one of | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | =over 4 | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | =item format | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | Either 'xml' or 'json'. Defaults to 'xml'. | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | =back | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | =cut | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub location { | ||||||||||||||||||||||||||
|
Subroutine
location: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 180 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 181 | 0 | my %opts = @_; | |||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | my $url = $QUERY_API_URL; | |||||||||||||||||||||||||||
| 184 | 0 | ▶ | $url .= '.'.$opts{format} if defined $opts{format}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 0 | return $self->_make_restricted_request($url, 'GET'); | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | =head2 update_location <location> <opt[s]> | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | Takes a free form string with the new location. | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | Return the result of the update in either xml or json | ||||||||||||||||||||||||||||
| 194 | depending on C<opts>. | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | The location can either be a plain string or a hash reference containing | ||||||||||||||||||||||||||||
| 197 | location parameters as described in | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | http://fireeagle.yahoo.net/developer/documentation/location#locparams | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | =cut | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub update_location { | ||||||||||||||||||||||||||
|
Subroutine
update_location: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 204 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 205 | 0 | my $location = shift; | |||||||||||||||||||||||||||
| 206 | 0 | my %opts = @_; | |||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 0 | my %extras = $self->_munge('address', $location); | |||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | 0 | my $url = $UPDATE_API_URL; | |||||||||||||||||||||||||||
| 211 | 0 | ▶ | $url .= '.'.$opts{format} if defined $opts{format}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 0 | return $self->_make_restricted_request($url, 'POST', %extras); | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | =head2 lookup_location <query> <opt[s]> | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | Disambiguates potential values for update. Results from lookup can be | ||||||||||||||||||||||||||||
| 219 | passed to update to ensure that Fire Eagle will understand how to parse | ||||||||||||||||||||||||||||
| 220 | the location parameter. | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | Return the result of the update in either xml or json | ||||||||||||||||||||||||||||
| 223 | depending on C<opts>. | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | The query can either be a plain string or a hash reference containing | ||||||||||||||||||||||||||||
| 226 | location parameters as described in | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | http://fireeagle.yahoo.net/developer/documentation/location#locparams | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | =cut | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 0 | ▶ | sub lookup_location { | ||||||||||||||||||||||||||
|
Subroutine
lookup_location: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 233 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 234 | 0 | my $location = shift; | |||||||||||||||||||||||||||
| 235 | 0 | my %opts = @_; | |||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | 0 | my %extras = $self->_munge('address', $location); | |||||||||||||||||||||||||||
| 238 | 0 | my $url = $LOOKUP_API_URL; | |||||||||||||||||||||||||||
| 239 | 0 | ▶ | $url .= '.'.$opts{format} if defined $opts{format}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | return $self->_make_restricted_request($url, 'GET', %extras); | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | =head2 within <query> <opt[s]> | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | Takes a Place ID or a WoE ID and returns a list of users using your | ||||||||||||||||||||||||||||
| 247 | application who are within the bounding box of that location. | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | Return the result of the update in either xml or json | ||||||||||||||||||||||||||||
| 250 | depending on C<opts>. | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | The query can either be a plain string or a hash reference containing | ||||||||||||||||||||||||||||
| 253 | location parameters as described in | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | http://fireeagle.yahoo.net/developer/documentation/location#locparams | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | =cut | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub within { | ||||||||||||||||||||||||||
|
Subroutine
within: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 260 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 261 | 0 | my $location = shift; | |||||||||||||||||||||||||||
| 262 | 0 | my %opts = @_; | |||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 0 | my %extras = $self->_munge('address', $location); | |||||||||||||||||||||||||||
| 265 | 0 | my $url = $WITHIN_API_URL; | |||||||||||||||||||||||||||
| 266 | 0 | ▶ | $url .= '.'.$opts{format} if defined $opts{format}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | return $self->_make_restricted_request_general($url, 'GET', %extras); | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | =head2 recent <query> [opt[s]] | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | Query for users of an Application who have updated their locations recently. | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | Return the result of the update in either xml or json | ||||||||||||||||||||||||||||
| 277 | depending on C<opts>. | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | Query is either a number representing a unix time stamp, to | ||||||||||||||||||||||||||||
| 280 | specify the earliest update to return, or a hash reference containing | ||||||||||||||||||||||||||||
| 281 | parameters as described in | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | http://fireagle.yahoo.net/developer/documentation/querying#recent | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =cut | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 0 | ▶ | sub recent { | ||||||||||||||||||||||||||
|
Subroutine
recent: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 288 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 289 | 0 | my $time = shift; | |||||||||||||||||||||||||||
| 290 | 0 | my %opts = @_; | |||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 0 | my %extras = $self->_munge('time', $time); | |||||||||||||||||||||||||||
| 293 | 0 | my $url = $RECENT_API_URL; | |||||||||||||||||||||||||||
| 294 | 0 | ▶ | $url .= '.'.$opts{format} if defined $opts{format}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 0 | return $self->_make_restricted_request_general($url, 'GET', %extras); | |||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 0 | ▶ | sub _make_restricted_request_general { | ||||||||||||||||||||||||||
|
Subroutine
_make_restricted_request_general: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 300 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 301 | 0 | my $response = $self->make_general_request(@_); | |||||||||||||||||||||||||||
| 302 | 0 | return $response->content; | |||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 0 | ▶ | sub _make_restricted_request { | ||||||||||||||||||||||||||
|
Subroutine
_make_restricted_request: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 306 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 307 | 0 | my $response = $self->make_restricted_request(@_); | |||||||||||||||||||||||||||
| 308 | 0 | return $response->content; | |||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | ▶ | sub _munge { | ||||||||||||||||||||||||||
|
Subroutine
_munge: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 312 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 313 | 0 | my $key = shift; | |||||||||||||||||||||||||||
| 314 | 0 | ▶ | my $item = shift || return (); | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || (return ())
MC/DC0%0/1
shift() || (return ())
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 315 | 0 | my $ref = ref($item); | |||||||||||||||||||||||||||
| 316 | 0 | ▶ | return ( $key => $item ) if !defined $ref or "" eq $ref; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $ref or "" eq $ref
MC/DC0%0/2
not defined $ref or "" eq $ref
not defined $ref
"" eq $ref
Truth table0%0/3
not(A) or B
A= not defined $refB= "" eq $ref
| |||||||||||||||||||||||||||||
| 317 | 0 | ▶ | return %$item if 'HASH' eq $ref; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 318 | 0 | die "Can't understand $key parameter in the form of a $ref ref"; | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =head1 BUGS | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | Non known | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | =head1 DEVELOPERS | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | The latest code for this module can be found at | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | https://svn.unixbeard.net/simon/Net-FireEagle | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | Original code by Yahoo! Brickhouse. | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | Additional code from Aaron Straup Cope | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | Rewritten and packaged by Simon Wistow <swistow@sixapart.com> | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | Copyright 2008 - Simon Wistow and Yahoo! Brickhouse | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | Distributed under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | See L<perlartistic> and L<perlgpl>. | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | L<Net::OAuth::Simple> | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | =cut | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | 3 | 1; | |||||||||||||||||||||||||||