blib/lib/Tie/Timely.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 10 | 10 | 100.0 |
branch | 2 | 2 | 100.0 |
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | n/a | ||
total | 16 | 16 | 100.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Tie::Timely; | ||||||
2 | 2 | 2 | 1362 | use strict; | |||
2 | 4 | ||||||
2 | 303 | ||||||
3 | |||||||
4 | our $VERSION = '1.023'; | ||||||
5 | |||||||
6 | sub TIESCALAR { | ||||||
7 | 1 | 1 | 552 | my( $class, $value, $lifetime ) = @_; | |||
8 | |||||||
9 | 1 | 3 | my $self = bless [ undef, $lifetime, time ], $class; | ||||
10 | |||||||
11 | 1 | 2 | $self->STORE( $value ); | ||||
12 | |||||||
13 | 1 | 3 | return $self; | ||||
14 | } | ||||||
15 | |||||||
16 | 2 | 100 | 2 | 4000663 | sub FETCH { time - $_[0]->[2] > $_[0]->[1] ? () : $_[0]->[0] } | ||
17 | |||||||
18 | 1 | 1 | 2 | sub STORE { @{ $_[0] }[0,2] = ( $_[1], time ) } | |||
1 | 4 | ||||||
19 | |||||||
20 | 1; | ||||||
21 | |||||||
22 | __END__ |