File Coverage

blib/lib/OpenERP/OOM/Roles/Class.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             OpenERP::OOM::Roles::Class - Class attribute for setting up dirty attribute tracking.
4              
5             =head1 DESCRIPTION
6              
7             This code was largely taken from a version of MooseX::TrackDirty before it
8             was updated to work with Moose 2.0. Then it was cut down to suit our purposes
9             being uses in the Moose::Exporter.
10              
11              
12             =head1 LICENSE AND COPYRIGHT
13              
14             Copyright (C) 2011 OpusVL
15              
16             This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
17              
18             =cut
19              
20             package OpenERP::OOM::Roles::Class;
21 3     3   11726 use namespace::autoclean;
  3         6  
  3         49  
22 3     3   244 use Moose::Role;
  3         4  
  3         44  
23              
24             has __track_dirty => (
25             traits => [ 'Hash' ],
26             is => 'rw',
27             isa => 'HashRef',
28             builder => '__build_track_dirty',
29              
30             handles => {
31             is_dirty => 'exists',
32             mark_clean => 'delete',
33             mark_all_clean => 'clear',
34             has_dirty_attributes => 'count',
35             all_attributes_clean => 'is_empty',
36             dirty_attributes => 'keys',
37             _set_dirty => 'set',
38             },
39             );
40              
41 1     1   904 sub __build_track_dirty { { } }
42 1     1   36 sub _mark_dirty { shift->_set_dirty(shift, 1) }
43              
44             1;
45