Branch Coverage

blib/lib/WWW/Telegram/BotAPI.pm
Criterion Covered Total %
branch 29 66 43.9


line true false branch
14 0 3 unless eval 'require Mojo::UserAgent; 1' or eval 'require LWP::UserAgent; 1'
25 0 0 if @_
39 1 5 unless exists $settings{'token'}
54 3 2 if $settings{'force_lwp'}
57 3 2 $settings{'force_lwp'} || !'Mojo::UserAgent'->can('new') ? :
59 1 4 if $settings{'async'} ||= 0 and $settings{'_agent'}->isa('LWP::UserAgent')
95 0 0 if $_ eq 'CODE' and $self->{'async'}
96 2 0 if $_ eq 'HASH'
98 0 2 if defined $async_cb and defined $postdata
105 2 2 if (defined $postdata)
123 0 1 $has_file_upload ? :
1 1 $is_lwp ? :
2 0 unless my $ref = ref $postdata->{$k}
125 0 0 if ($ref eq 'HASH' and exists $postdata->{$k}{'file'} || exists $postdata->{$k}{'content'}) { }
132 0 0 unless $is_lwp
147 0 0 if exists $postdata->{$k}{'content'}
155 0 0 if $has_file_upload
160 0 2 if ($has_file_upload) { }
165 0 0 unless $is_lwp and push @request, 'Content', $postdata, 'Content_Type', 'form-data'
172 1 1 unless $is_lwp and push @request, (), 'Content', &JSON::MaybeXS::encode_json($postdata), 'Content_Type', 'application/json'
182 0 4 if $async_cb
184 4 0 if $self->{'_dry_run'}
192 0 0 if $async_cb
195 0 0 $is_lwp ? :
200 0 0 $is_lwp ? :
0 0 unless ($is_lwp ? $tx->is_success : $tx->success and $response and $response->{'ok'})
209 0 0 $response->{'error_code'} ? :
222 1 3 unless $r->{'msg'} =~ /ERROR: (?:code ([0-9]+): )?(.+?)(?:\s+at .+)?$/m
224 1 2 if $1
228 1 2 exists $r->{'code'} ? :
3 0 if $r->{'msg'} ne 'something went wrong!'
247 0 0 if (@$args > 1 and $args->[1] eq 'DBG')
257 0 0 if ref $args_cpy->[-1] eq 'CODE'