| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | package KiokuDB::Role::Immutable; | ||
| 4 | 4 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 4 | ▶ | use namespace::clean -except => 'meta'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | |||
| 9 | |||
| 10 | 4 | __PACKAGE__ | |
| 11 | |||
| 12 | __END__ | ||
| 13 | |||
| 14 | =pod | ||
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | KiokuDB::Role::Immutable - A role for objects that are never updated. | ||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | with qw(KiokuDB::Role::Immutable); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | This is a role for objects that are never updated after they are inserted to | ||
| 27 | the database. | ||
| 28 | |||
| 29 | The object will be skipped entirely on all update/store operations unless it is | ||
| 30 | being collapsed for the first time, and its child objects will B<not> be | ||
| 31 | updated unless they are found while collapsing another object. | ||
| 32 | |||
| 33 | This means that: | ||
| 34 | |||
| 35 | my $immutable = $kiokudb->lookup($id); | ||
| 36 | |||
| 37 | $immutable->child->name("foo"); | ||
| 38 | |||
| 39 | $kiokudb->update($immutable); | ||
| 40 | |||
| 41 | will not work, you need to update the child directly: | ||
| 42 | |||
| 43 | $kiokudb->update($immutable->child); | ||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | |||