| 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 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | 3 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 3 | 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 | ▶ | sub __build_track_dirty { { } } |
|
Subroutine
__build_track_dirty: called CC=1 SCAR=0.0
| |||
| 42 | 1 | ▶ | sub _mark_dirty { shift->_set_dirty(shift, 1) } |
|
Subroutine
_mark_dirty: called CC=1 SCAR=0.0
| |||
| 43 | |||
| 44 | 3 | 1; | |
| 45 | |||