| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package EntityModel::Plugin; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$EntityModel::Plugin::VERSION = '0.102'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
sub import; # forward ref due to the way the class is set up |
|
6
|
|
|
|
|
|
|
use EntityModel::Class { |
|
7
|
14
|
|
|
|
|
135
|
model => { type => 'EntityModel' } |
|
8
|
14
|
|
|
14
|
|
174393
|
}; |
|
|
14
|
|
|
|
|
28
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
EntityModel::Plugin - base class for plugin handling |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
version 0.102 |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
see L. |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
see L. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
|
27
|
|
|
|
|
|
|
|
|
28
|
14
|
|
|
14
|
|
15969
|
use EntityModel; |
|
|
14
|
|
|
|
|
32
|
|
|
|
14
|
|
|
|
|
132
|
|
|
29
|
14
|
|
|
14
|
|
384
|
use Scalar::Util qw(weaken); |
|
|
14
|
|
|
|
|
41
|
|
|
|
14
|
|
|
|
|
4316
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=pod |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
(the following is likely to be very inaccurate) |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Each plugin can register for a type: |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
->registerForType('table') - registers as a handler for 'table' content, e.g. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
in XML definitions. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub import { |
|
50
|
0
|
|
|
0
|
|
0
|
my $class = shift; |
|
51
|
0
|
|
|
|
|
0
|
my $pkg = caller; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# EntityModel->registerPlugin($pkg) if eval { $pkg->isa('EntityModel::Plugin'); }; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
1; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Provides import and export for entity model definitions to a given interface. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub new { |
|
65
|
1
|
|
|
1
|
1
|
85
|
my $class = shift; |
|
66
|
1
|
|
|
|
|
3
|
my $model = shift; |
|
67
|
1
|
|
|
|
|
5
|
my $self = bless { |
|
68
|
|
|
|
|
|
|
model => $model |
|
69
|
|
|
|
|
|
|
}, $class; |
|
70
|
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
13
|
weaken $self->{model}; |
|
72
|
|
|
|
|
|
|
# $self->setup(@_); |
|
73
|
1
|
|
|
|
|
3
|
return $self; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
0
|
0
|
0
|
sub setup { die "Virtual method setup called for " . $_[0]; } |
|
77
|
|
|
|
|
|
|
|
|
78
|
1
|
|
|
1
|
0
|
3
|
sub unload { $_[0]; } |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub publish { |
|
81
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
82
|
0
|
|
|
|
|
|
my $name = shift; |
|
83
|
0
|
|
|
|
|
|
my $value = shift; |
|
84
|
0
|
0
|
|
|
|
|
die "Key $name already present" if exists $self->model->{$name}; |
|
85
|
0
|
|
|
|
|
|
$self->model->{$name} = $value; |
|
86
|
0
|
|
|
|
|
|
return $self; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |