File Coverage

blib/lib/DBIx/Class/CDBICompat/AutoUpdate.pm
Criterion Covered Total %
statement 9 22 40.9
branch 0 10 0.0
condition 0 3 0.0
subroutine 3 7 42.8
pod 0 2 0.0
total 12 44 27.2


line stmt bran cond sub pod time code
1             package # hide from PAUSE
2             DBIx::Class::CDBICompat::AutoUpdate;
3              
4 2     2   963 use strict;
  2         5  
  2         77  
5 2     2   11 use warnings;
  2         4  
  2         46  
6              
7 2     2   10 use base 'DBIx::Class';
  2         8  
  2         488  
8              
9             __PACKAGE__->mk_group_accessors( inherited => '__AutoCommit' );
10              
11             sub set_column {
12 0     0 0   my $self = shift;
13 0           my $ret = $self->next::method(@_);
14 0 0 0       $self->update if ($self->autoupdate && $self->{_in_storage});
15 0           return $ret;
16             }
17              
18             sub autoupdate {
19 0     0 0   my $proto = shift;
20 0 0         ref $proto
21             ? $proto->_obj_autoupdate(@_)
22             : $proto->_class_autoupdate(@_) ;
23             }
24              
25             sub _obj_autoupdate {
26 0     0     my ($self, $set) = @_;
27 0           my $class = ref $self;
28 0 0         $self->{__AutoCommit} = $set if defined $set;
29             defined $self->{__AutoCommit}
30             ? $self->{__AutoCommit}
31 0 0         : $class->_class_autoupdate;
32             }
33              
34             sub _class_autoupdate {
35 0     0     my ($class, $set) = @_;
36 0 0         $class->__AutoCommit($set) if defined $set;
37 0           return $class->__AutoCommit;
38             }
39              
40             1;