EntityModel/Plugin.pm

filter: Statementstmt 64.2% 18 / 28 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 25.0% 1 / 4 totaltotal 57.1% 24 / 42 CC 2 SCAR 8.5
CC
2
Cov
60%
publish
6.0
import
2.0
setup
2.0
CRAP 2.3
« EntityModel/StorageClass/KVStore/Layer/Fake.pm ↑ Summary EntityModel/Transaction.pm »
1 package EntityModel::Plugin;
2 {
3 19 $EntityModel::Plugin::VERSION = '0.102';
4 }
5 sub import; # forward ref due to the way the class is set up
6 19 ▶use EntityModel::Class {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 19 model => { type => 'EntityModel' }
8 19 };
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<EntityModel>.
21  
22 =head1 DESCRIPTION
23  
24 see L<EntityModel>.
25  
26 =cut
27  
28 19 ▶use EntityModel;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 19 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
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 <table>...</table>
44  
45 in XML definitions.
46  
47 =cut
48  
49 0 ▶sub import {
Subroutine import: not called CC=1 SCAR=6.9
50 0 my $class = shift;
51 0 my $pkg = caller;
52  
53 # EntityModel->registerPlugin($pkg) if eval { $pkg->isa('EntityModel::Plugin'); };
54  
55 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 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
65 1 my $class = shift;
66 1 my $model = shift;
67 1 my $self = bless {
68 model => $model
69 }, $class;
70  
71 1 weaken $self->{model};
72 # $self->setup(@_);
73 1 return $self;
74 }
75  
76 0 ▶sub setup { die "Virtual method setup called for " . $_[0]; }
Subroutine setup: not called CC=1 SCAR=6.9
Pod undocumented
77  
78 1 ▶sub unload { $_[0]; }
Subroutine unload: called CC=1 SCAR=0.0
Pod undocumented
79  
80 0 ▶sub publish {
Subroutine publish: not called CC=2 SCAR=17.9
Pod undocumented
81 0 my $self = shift;
82 0 my $name = shift;
83 0 my $value = shift;
84 0 ▶ die "Key $name already present" if exists $self->model->{$name};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->model->{$name} 0 0 0
85 0 $self->model->{$name} = $value;
86 0 return $self;
87 }
88  
89 19 1;
90  
91 __END__
« EntityModel/StorageClass/KVStore/Layer/Fake.pm ↑ Summary EntityModel/Transaction.pm »