| 1 | package Kwiki::Registry; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Spoon::Registry '-Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | |||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 0 | ▶ | sub add { | ||||||||||||||||||||||||||
|
Subroutine
add: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 5 | 0 | my ($key, $value) = @_; | |||||||||||||||||||||||||||
| 6 | 0 | ▶ | return super | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key eq "preference" and @_ == 2
MC/DC0%0/2
$key eq "preference" and @_ == 2
$key eq "preference"
@_ == 2
Truth table0%0/3
A and B
A= $key eq "preference"B= @_ == 2
| |||||||||||||||||||||||||||||
| 7 | unless $key eq 'preference' and @_ == 2; | ||||||||||||||||||||||||||||
| 8 | 0 | super($key, $value->id, object => $value); | |||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub not_a_plugin { | ||||||||||||||||||||||||||
|
Subroutine
not_a_plugin: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 0 | my $class_name = shift; | |||||||||||||||||||||||||||
| 13 | 0 | die <<END; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | Error: | ||||||||||||||||||||||||||||
| 16 | $class_name is not a plugin class. | ||||||||||||||||||||||||||||
| 17 | see: http://www.kwiki.org/?InstallingPlugins | ||||||||||||||||||||||||||||
| 18 | END | ||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub plugin_redefined { | ||||||||||||||||||||||||||
|
Subroutine
plugin_redefined: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 22 | 0 | my ($class_id, $class_name, $prev_name) = @_; | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | die <<END if $class_name eq $prev_name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | Error: | ||||||||||||||||||||||||||||
| 26 | Plugin class $class_name defined twice. | ||||||||||||||||||||||||||||
| 27 | see: http://www.kwiki.org/?InstallingPlugins | ||||||||||||||||||||||||||||
| 28 | END | ||||||||||||||||||||||||||||
| 29 | 0 | die <<END; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | Error: | ||||||||||||||||||||||||||||
| 32 | Can't use two plugins with the same class id. | ||||||||||||||||||||||||||||
| 33 | $prev_name and $class_name both have a class id of '$class_id'. | ||||||||||||||||||||||||||||
| 34 | see: http://www.kwiki.org/?InstallingPlugins | ||||||||||||||||||||||||||||
| 35 | END | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub validate { | ||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $self->validate_prerequisite or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | return 1; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub validate_prerequisite { | ||||||||||||||||||||||||||
|
Subroutine
validate_prerequisite: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 0 | for my $hashlet (@{$self->lookup->{plugins}}) { | |||||||||||||||||||||||||||
| 45 | 0 | my $class_id = $hashlet->{id}; | |||||||||||||||||||||||||||
| 46 | my $prereqs = $self->lookup->{add_order}{$class_id}{prerequisite} | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | for my $prereq (@$prereqs) { | |||||||||||||||||||||||||||
| 49 | $self->missing_prerequisite($class_id, $prereq) | ||||||||||||||||||||||||||||
| 50 | 0 | ▶ | unless defined $self->lookup->{classes}{$prereq}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | 0 | return 1; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub missing_prerequisite { | ||||||||||||||||||||||||||
|
Subroutine
missing_prerequisite: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 57 | 0 | my ($class_id, $prereq) = @_; | |||||||||||||||||||||||||||
| 58 | 0 | my $class_name = $self->lookup->{classes}{$class_id}; | |||||||||||||||||||||||||||
| 59 | 0 | die "Missing prerequisite plugin '$prereq' for $class_name\n"; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | __DATA__ | |||||||||||||||||||||||||||