| 1 | package WWW::Tumblr::Authentication::OAuth; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 16 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 16 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 16 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 16 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # Note: Extends WWW::Tumblr which already uses WWW::Tumblr::Authentication | ||||||||||||||||||||||||||||
| 10 | 16 | extends 'WWW::Tumblr'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | has 'authorize_url', is => 'rw', isa => 'Str', lazy => 1, default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 13 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 14 | 0 | ▶ | croak "The consumer_key and secret_key must be defined!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->consumer_key and $self->secret_key
MC/DC0%0/2
$self->consumer_key and $self->secret_key
$self->consumer_key
$self->secret_key
Truth table0%0/3
A and B
A= $self->consumer_keyB= $self->secret_key
| |||||||||||||||||||||||||||||
| 15 | unless $self->consumer_key && $self->secret_key; | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | return $self->oauth->authorize_url(); | |||||||||||||||||||||||||||
| 18 | 16 | }; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 16 | has 'oauth_token', is => 'rw', isa => 'Str'; | |||||||||||||||||||||||||||
| 21 | 16 | has 'oauth_verifier', is => 'rw', isa => 'Str'; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | has 'token', is => 'rw', isa => 'Str', lazy => 1, default => sub{ shift->_get_token() }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | has 'token_secret', is => 'rw', isa => 'Str', lazy => 1, default => sub { shift->_get_token('secret') }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 16 | has '_access_token', is => 'rw'; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub _get_token { | ||||||||||||||||||||||||||
|
Subroutine
_get_token: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 29 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 30 | 0 | ▶ | my $type = shift || 'token'; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'token'
MC/DC0%0/1
shift() || 'token'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | croak "Cannot get OAuth token without 'oauth_token' and 'oauth_verifier' defined!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->oauth_token and $self->oauth_verifier
MC/DC0%0/2
$self->oauth_token and $self->oauth_verifier
$self->oauth_token
$self->oauth_verifier
Truth table0%0/3
A and B
A= $self->oauth_tokenB= $self->oauth_verifier
| |||||||||||||||||||||||||||||
| 33 | unless $self->oauth_token && $self->oauth_verifier; | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | warn "Session looks empty, _get_token will fall, probably" | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | unless keys %{ $self->_session }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | $self->_access_token( $self->oauth->get_access_token( $self->oauth_token, $self->oauth_verifier ) ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | unless $self->_access_token; | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | ▶ | return $type eq 'secret' ? $self->_access_token->token_secret : $self->_access_token->token; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 16 | 1; | |||||||||||||||||||||||||||