| 1 | package Net::Google::Code::Issue::Base; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | has 'project' => ( | |||||||||||||||||||||||||||||||||||||||||
| 7 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 8 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 9 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 9 | has 'token' => ( | |||||||||||||||||||||||||||||||||||||||||
| 12 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 13 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 9 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 9 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | sub feeds_issues_url { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
feeds_issues_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | return | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | 'http://code.google.com/feeds/issues/p/' | |||||||||||||||||||||||||||||||||||||||||
| 23 | . $self->project | ||||||||||||||||||||||||||||||||||||||||||
| 24 | . '/issues'; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | ▶ | sub ua { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ua: called CC=6 SCAR=20.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | my $skip_auth = shift; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | require Net::Google::Code; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | my $ua = LWP::UserAgent->new( agent => 'net-google-code-issue/' | |||||||||||||||||||||||||||||||||||||||||
| 32 | . $Net::Google::Code::VERSION ); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | ▶ | return $ua if $skip_auth; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | $ua->default_header( 'Content-Type' => 'application/atom+xml' ); | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | # get auth token | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 3 | ▶ | if ( $self->email && $self->password && !$self->token ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$self->email and $self->password and not $self->token
$self->email and $self->password
MC/DC0%0/3
$self->email and $self->password and not $self->token
$self->email
$self->password
not $self->token
Truth table25%1/4
A and B and not(C)
A= $self->emailB= $self->passwordC= not $self->token
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | $self->get_token(); | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | ▶ | $ua->default_header( Authorization => 'GoogleLogin auth=' . $self->token ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | if $self->token; | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 3 | return $ua; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub get_token { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_token: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $ua = $self->ua(1); # don't need auth | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $response = $ua->post( | |||||||||||||||||||||||||||||||||||||||||
| 51 | 'https://www.google.com/accounts/ClientLogin', | ||||||||||||||||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||||||||||||||||
| 53 | Email => $self->email, | ||||||||||||||||||||||||||||||||||||||||||
| 54 | Passwd => $self->password, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | service => 'code', | ||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if ( $response->is_success && $response->content =~ /Auth=(\S+)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$response->is_success and $response->content =~ /Auth=(\S+)/
MC/DC0%0/2
$response->is_success and $response->content =~ /Auth=(\S+)/
$response->is_success
$response->content =~ /Auth=(\S+)/
Truth table0%0/3
A and B
A= $response->is_successB= $response->content =~ /Auth=(\S+)/
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $self->token($1); | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | warn "failed to get auth token: " | |||||||||||||||||||||||||||||||||||||||||
| 63 | . $response->status_line . "\n" | ||||||||||||||||||||||||||||||||||||||||||
| 64 | . $response->content; | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | __END__ | ||||||||||||||||||||||||||||||||||||||||||