line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package KiokuDB::Role::ID; |
4
|
4
|
|
|
4
|
|
2143
|
use Moose::Role; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
14374
|
use namespace::clean -except => 'meta'; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
requires "kiokudb_object_id"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__ |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__END__ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=pod |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
KiokuDB::Role::ID - A role for objects who choose their own ID. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# typically you set up your own ID role, and map the C<kiokudb_object_id> |
23
|
|
|
|
|
|
|
# method to your shema's ID |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
package MySchema::ID; |
26
|
|
|
|
|
|
|
use Moose::Role; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
with qw(KiokuDB::Role::ID); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub kiokudb_object_id { shift->id }; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
requires "id"; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
package MySchema::Foo; |
38
|
|
|
|
|
|
|
use Moose; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
with qw(MySchema::ID); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub id { ... } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This role provides a way for objects to determine their own IDs. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
You must implement or alias the C<kiokudb_object_id> method to return a string. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 REQUIRED METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over 4 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item kiokudb_object_id |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Should return a string to be used as the ID of the object. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=back |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|