Branch Coverage

blib/lib/WWW/Telegram/BotAPI.pm
Criterion Covered Total %
branch 26 72 36.1


line true false branch
14 0 3 unless eval 'require Mojo::UserAgent; 1' or eval 'require LWP::UserAgent; 1'
25 0 0 if @_
26 0 0 defined $to_dump ? :
39 1 5 unless exists $settings{'token'}
54 3 2 if $settings{'force_lwp'}
57 5 0 if ($settings{'force_lwp'} or not 'Mojo::UserAgent'->can('new')) { }
66 0 0 unless $tx->req->method eq 'CONNECT'
70 0 0 if $tx->error
75 1 4 if $settings{'async'} ||= 0 and $settings{'_agent'}->isa('LWP::UserAgent')
111 0 0 if $_ eq 'CODE' and $self->{'async'}
112 2 0 if $_ eq 'HASH'
114 0 2 if defined $async_cb and defined $postdata
121 2 2 if (defined $postdata)
139 0 2 $has_file_upload ? :
2 0 $is_lwp ? :
2 0 unless my $ref = ref $postdata->{$k}
141 0 0 if ($ref eq 'HASH' and exists $postdata->{$k}{'file'} || exists $postdata->{$k}{'content'}) { }
148 0 0 unless $is_lwp
163 0 0 if exists $postdata->{$k}{'content'}
171 0 0 if $has_file_upload
176 0 2 if ($has_file_upload) { }
181 0 0 unless $is_lwp and push @request, 'Content', $postdata, 'Content_Type', 'form-data'
188 0 2 unless $is_lwp and push @request, (), 'Content', &JSON::MaybeXS::encode_json($postdata), 'Content_Type', 'application/json'
198 0 4 if $async_cb
200 4 0 if $self->{'_dry_run'}
208 0 0 if $async_cb
211 0 0 $is_lwp ? :
216 0 0 $is_lwp ? :
0 0 unless ($is_lwp ? $tx->is_success : !$tx->error and $response and $response->{'ok'})
224 0 0 $response->{'error_code'} ? :
237 1 3 unless $r->{'msg'} =~ /ERROR: (?:code ([0-9]+): )?(.+?)(?:\s+at .+)?$/m
239 1 2 if $1
243 1 2 exists $r->{'code'} ? :
3 0 if $r->{'msg'} ne 'something went wrong!'
262 0 0 if (@$args > 1 and $args->[1] eq 'DBG')
272 0 0 if ref $args_cpy->[-1] eq 'CODE'