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 | 1117 | use strict; | |||
2 | 4 | ||||||
2 | 278 | ||||||
3 | |||||||
4 | our $VERSION = '1.024'; | ||||||
5 | |||||||
6 | sub TIESCALAR { | ||||||
7 | 1 | 1 | 470 | my( $class, $value, $lifetime ) = @_; | |||
8 | |||||||
9 | 1 | 3 | my $self = bless [ undef, $lifetime, time ], $class; | ||||
10 | |||||||
11 | 1 | 3 | $self->STORE( $value ); | ||||
12 | |||||||
13 | 1 | 2 | return $self; | ||||
14 | } | ||||||
15 | |||||||
16 | 2 | 100 | 2 | 4000695 | sub FETCH { time - $_[0]->[2] > $_[0]->[1] ? () : $_[0]->[0] } | ||
17 | |||||||
18 | 1 | 1 | 1 | sub STORE { @{ $_[0] }[0,2] = ( $_[1], time ) } | |||
1 | 5 | ||||||
19 | |||||||
20 | 1; | ||||||
21 | |||||||
22 | __END__ |