| 1 | package HTTP::API::Core::Example::GitHub; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use parent 'HTTP::API::Core'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 8 | 1 | my ($class, %args) = @_; | |||||||||||||||||||||||||||
| 9 | 1 | my $token = delete $args{token}; | |||||||||||||||||||||||||||
| 10 | 1 | ▶ | die "token is required\n" if !defined($token) || $token eq ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $token or $token eq ""
MC/DC0%0/2
not defined $token or $token eq ""
not defined $token
$token eq ""
Truth table33%1/3
not(A) or B
A= not defined $tokenB= $token eq ""
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | return $class->SUPER::new( | |||||||||||||||||||||||||||
| 13 | base_url => 'https://api.github.com', | ||||||||||||||||||||||||||||
| 14 | headers => { | ||||||||||||||||||||||||||||
| 15 | Accept => 'application/vnd.github+json', | ||||||||||||||||||||||||||||
| 16 | Authorization => "Bearer $token", | ||||||||||||||||||||||||||||
| 17 | 'X-GitHub-Api-Version' => '2026-03-10', | ||||||||||||||||||||||||||||
| 18 | }, | ||||||||||||||||||||||||||||
| 19 | %args, | ||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | sub repositories_pager { | ||||||||||||||||||||||||||
|
Subroutine
repositories_pager: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 1 | my ($self, %args) = @_; | |||||||||||||||||||||||||||
| 25 | 1 | ▶ | my $per_page = delete($args{per_page}) || 100; | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $args{'per_page'} || 100
MC/DC0%0/1
delete $args{'per_page'} || 100
delete $args{'per_page'}
Truth table50%1/2
A
A= delete $args{'per_page'}
| |||||||||||||||||||||||||||||
| 26 | 1 | my $affiliation = delete $args{affiliation}; | |||||||||||||||||||||||||||
| 27 | 1 | my $sort = delete $args{sort}; | |||||||||||||||||||||||||||
| 28 | 1 | my $direction = delete $args{direction}; | |||||||||||||||||||||||||||
| 29 | 1 | die "unknown repositories option: $_\n" for sort keys %args; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | return $self->paginate( | ||||||||||||||||||||||||||||
| 32 | '/user/repos', | ||||||||||||||||||||||||||||
| 33 | mode => 'next_url', | ||||||||||||||||||||||||||||
| 34 | response_aware_extractors => 1, | ||||||||||||||||||||||||||||
| 35 | 2 | ▶ | items => sub { return $_[0] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 36 | 2 | ▶ | next => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 37 | 2 | my ($data, $response) = @_; | |||||||||||||||||||||||||||
| 38 | 2 | ▶ | my $link = $response->header('link') || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
$response->header('link') || ''
MC/DC100%1/1
$response->header('link') || ''
$response->header('link')
Truth table100%2/2
A
A= $response->header('link')
| |||||||||||||||||||||||||||||
| 39 | 2 | for my $part (split /,\s*/, $link) { | |||||||||||||||||||||||||||
| 40 | 1 | ▶ | return $1 if $part =~ /<([^>]+)>;\s*rel="next"/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 1 | return undef; | |||||||||||||||||||||||||||
| 43 | }, | ||||||||||||||||||||||||||||
| 44 | 1 | query => { | |||||||||||||||||||||||||||
| 45 | per_page => $per_page, | ||||||||||||||||||||||||||||
| 46 | affiliation => $affiliation, | ||||||||||||||||||||||||||||
| 47 | sort => $sort, | ||||||||||||||||||||||||||||
| 48 | direction => $direction, | ||||||||||||||||||||||||||||
| 49 | }, | ||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 1 | 1; | |||||||||||||||||||||||||||