blib/lib/Server/Starter/Guard.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 11 | 11 | 100.0 |
branch | 2 | 2 | 100.0 |
condition | n/a | ||
subroutine | 5 | 5 | 100.0 |
pod | 0 | 2 | 0.0 |
total | 18 | 20 | 90.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Server::Starter::Guard; | ||||||
2 | |||||||
3 | 61 | 61 | 1759 | use strict; | |||
61 | 104 | ||||||
61 | 1940 | ||||||
4 | 61 | 61 | 236 | use warnings; | |||
61 | 69 | ||||||
61 | 7275 | ||||||
5 | |||||||
6 | sub new { | ||||||
7 | 76 | 76 | 0 | 7312 | my ($klass, $handler) = @_; | ||
8 | 76 | 1825 | return bless { | ||||
9 | handler => $handler, | ||||||
10 | active => 1, | ||||||
11 | }, $klass; | ||||||
12 | } | ||||||
13 | |||||||
14 | 5 | 5 | 0 | 195 | sub dismiss { shift->{active} = 0 } | ||
15 | |||||||
16 | sub DESTROY { | ||||||
17 | 31 | 31 | 1003048 | my $self = shift; | |||
18 | 31 | 100 | 1882 | $self->{active} && $self->{handler}->(); | |||
19 | } | ||||||
20 | |||||||
21 | 1; |