| 1 | package UserAgent::Any::Fake; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.036; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Scalar::Util 'blessed'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use UserAgent::Any::Fake::Request; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use UserAgent::Any::Fake::Response; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use UserAgent::Any::Impl::Helper 'generate_methods'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | our $VERSION = 0.01; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | extends 'UserAgent::Any'; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | with 'UserAgent::Any::Impl'; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | has '+_impl' => (required => 0,); | |||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | has '+ua' => (required => 0,); | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | has _handler => (is => 'ro',); | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=18.9
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | my ($orig, $class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | ▶ | return {_handler => $args[0]} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
@args == 1 and ref $args[0] ne "HASH" || !builtin::blessed($args[0])
ref $args[0] ne "HASH" or not builtin::blessed($args[0])
MC/DC0%0/3
@args == 1 and ref $args[0] ne "HASH" || !builtin::blessed($args[0])
@args == 1
ref $args[0] ne "HASH"
not builtin::blessed($args[0])
Truth table25%1/4
A and B or not(C)
A= @args == 1B= ref $args[0] ne "HASH"C= not builtin::blessed($args[0])
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | if @args == 1 && (ref($args[0]) ne 'HASH' || !blessed($args[0])); | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | return $class->$orig(@args); | |||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | sub call ($self, @args) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | my $req = UserAgent::Any::Fake::Request->new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | my $res = UserAgent::Any::Fake::Response->new(status_code => 200, status_text => 'SUCCESS'); | |||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | $self->_handler->($req, $res); | |||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | return $res; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub call_cb ($self, $url, %params) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call_cb: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | croak 'UserAgent::Any async methods are not implemented with UserAgent::Any::Fake'; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub call_p ($self, $url, %params) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
call_p: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | croak 'UserAgent::Any async methods are not implemented with UserAgent::Any::Fake'; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | BEGIN { generate_methods() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||||||||||||||||