Branch Coverage

blib/lib/Plack/Middleware/Greylist.pm
Criterion Covered Total %
branch 38 50 76.0


line true false branch
29 0 5 unless defined $self->default_rate
31 0 5 unless $self->default_rate =~ /^[1-9][0-9]*$/u
34 0 5 unless defined $config
41 3 2 unless defined $self->retry_after
42 0 5 unless $self->retry_after =~ /^[1-9][0-9]*$/u and $self->retry_after > $expiry
45 5 0 unless ($self->cache)
48 0 5 unless defined $file
52 0 5 if "Cache::FastMmap"->VERSION < "1.52"
76 5 0 if (my $greylist = $self->greylist)
88 8 7 unless is_plain_arrayref($rule)
94 3 12 if $mask eq 1
97 4 11 if (exists $codes{$rate})
98 4 0 if $mask eq ""
106 1 4 if (my $fn = $self->callback) { }
107 0 1 unless is_coderef($fn)
115 15 0 if (my $log = $env->{'psgix.logger'}) { }
132 84 17 $name ? :
136 3 4 if ($rate == 0 and $rule->[1] and $rule->[1] eq "norobots")
137 2 1 if ($env->{'PATH_INFO'} eq "/robots.txt")
142 89 12 if ($rate >= 0)
147 17 72 $hits > $rate ? :
149 17 72 if ($limit)
153 17 0 if (my $fn = $self->callback)
154 1 16 unless &$fn({"env", $env, "ip", $ip, "hits", $limit, "rate", $rate, "block", $block, "message", "Rate limiting $ip after $limit/$rate for $block"})
166 5 11 if ($rate == 0) { }