Branch Coverage

lib/CGI/Application/Plugin/Throttle.pm
Criterion Covered Total %
branch 37 48 77.0


line true false branch
126 2 5 if (UNIVERSAL::can($callpkg, 'add_callback'))
194 30 34 if $cgi_app->{'__throttle_obj'}
242 0 0 if ($ENV{$env})
288 0 0 if ($self->{'redis'})
331 10 20 if (my $exceeded = $self->_is_exceeded($rule, $keys))
340 0 20 if ($cgi_app->query->url_param($cgi_app->mode_param))
416 15 18 if $args{'limit'}
417 15 18 if $args{'period'}
422 3 30 if $args{'prefix'}
427 30 3 if $args{'redis'}
432 0 33 if $args{'exceeded'}
479 1 32 if scalar @throttle_keys == 1 and not defined $throttle_keys[0]
483 32 0 unless exists {@throttle_keys}->{'prefix'}
495 0 40 unless defined $keys
523 17 23 unless $self->{'throttle_spec_callback'}
528 2 21 scalar @spec % 2 ? :
532 14 20 unless $self->_match_all($filter, $keys)
561 10 27 unless exists $lookup->{$_}
566 23 4 if (defined $filter->{$_} && $filter->{$_}) eq (defined $lookup->{$_} && $lookup->{$_})
571 4 0 if defined $filter->{$_} or defined $lookup->{$_}
583 0 30 unless defined $keys
585 0 30 unless my $redis = $self->{'redis'}
596 6 24 if $cur == 1
601 10 20 if $cur > $rule->{'limit'}