File Coverage

blib/lib/Pixie/LockStrat.pm
Criterion Covered Total %
statement 10 18 55.5
branch 2 6 33.3
condition n/a
subroutine 3 7 42.8
pod 0 5 0.0
total 15 36 41.6


line stmt bran cond sub pod time code
1             package Pixie::LockStrat;
2              
3 16     16   95 use base 'Pixie::Object';
  16         26  
  16         4924  
4              
5 0     0 0 0 sub pre_get {}
6              
7 0     0 0 0 sub post_get {}
8              
9             sub pre_store {
10 0     0 0 0 my $self = shift;
11 0         0 my($oid, $pixie) = @_;
12 0         0 $pixie->store->lock_object_for($oid, $pixie);
13             }
14              
15             sub post_store {
16 0     0 0 0 my $self = shift;
17 0         0 my ($oid, $pixie, $pre_status) = @_;
18 0 0       0 $pixie->store->unlock_object_for($oid, $pixie) if $pre_status;
19             }
20              
21             sub on_DESTROY {
22 25     25 0 48 my $self = shift;
23 25         50 local $@;
24 25         53 my ($oid, $pixie) = @_;
25 25         70 $self->{on_DESTROY_called} = 1;
26 25         128 my $store = $pixie->store;
27 25 50       208 $store->unlock_object_for($oid, $pixie) if $store;
28             }
29              
30             sub DESTROY {
31 25 50   25   593 warn "LockStrat destroyed" unless $_[0]->{on_DESTROY_called};
32             }
33             1;