File Coverage

blib/lib/KiokuDB/Role/Immutable.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package KiokuDB::Role::Immutable;
4 4     4   3303 use Moose::Role;
  4         6  
  4         23  
5              
6 4     4   15189 use namespace::clean -except => 'meta';
  4         8  
  4         28  
7              
8              
9              
10             __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