line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mandel::Relationship; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Mandel::Relationship - Base class for relationships |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
L is the base class for the following classes: |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=over 4 |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=item * L |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=item * L |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=item * L |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=back |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
4
|
|
|
4
|
|
2102
|
use Mojo::Base -base; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
28
|
|
24
|
4
|
|
|
4
|
|
599
|
use Mojo::Loader 'load_class'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
807
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 accessor |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Base name of accessor(s) created. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 foreign_field |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The name of the field in the foreign class which hold the "_id". |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 document_class |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Holds the classname of the document class that holds all the accessors and |
39
|
|
|
|
|
|
|
methods created. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 related_class |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Holds the related document class name. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has accessor => ''; |
48
|
|
|
|
|
|
|
has document_class => ''; |
49
|
|
|
|
|
|
|
has foreign_field => sub { shift->document_class->model->name }; |
50
|
|
|
|
|
|
|
has related_class => ''; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# is this a bad memory leak? $model => $rel_obj => $_related_model |
53
|
|
|
|
|
|
|
# i don't think so, since the number of objects are constant |
54
|
|
|
|
|
|
|
has _related_model => sub { |
55
|
|
|
|
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
my $e = load_class($self->related_class); |
57
|
|
|
|
|
|
|
die $e if ref $e; |
58
|
|
|
|
|
|
|
$self->related_class->model; |
59
|
|
|
|
|
|
|
}; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SEE ALSO |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
L, L, L |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Jan Henning Thorsen - C |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |