| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Starch::Plugin::RenewExpiration::State; |
|
2
|
1
|
|
|
1
|
|
476
|
use 5.008001; |
|
|
1
|
|
|
|
|
4
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strictures 2; |
|
|
1
|
|
|
|
|
7
|
|
|
|
1
|
|
|
|
|
34
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
181
|
use Moo::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
5
|
|
|
7
|
1
|
|
|
1
|
|
331
|
use namespace::clean; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with qw( |
|
10
|
|
|
|
|
|
|
Starch::Plugin::ForState |
|
11
|
|
|
|
|
|
|
); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
around save => sub{ |
|
14
|
|
|
|
|
|
|
my $orig = shift; |
|
15
|
|
|
|
|
|
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $manager = $self->manager(); |
|
18
|
|
|
|
|
|
|
my $thresh = $manager->renew_threshold(); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $variance = $manager->renew_variance(); |
|
21
|
|
|
|
|
|
|
if ($variance > 0) { |
|
22
|
|
|
|
|
|
|
my $delta = int($thresh * $variance); |
|
23
|
|
|
|
|
|
|
$thresh = ($thresh - $delta) + int( rand($delta+1) ); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->mark_dirty() if $self->modified() + $thresh <= time(); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return $self->$orig( @_ ); |
|
29
|
|
|
|
|
|
|
}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |