| 1 | package Template::Plugin::NDS_Multi; | ||||||||||||||||||||||||||||||||
| 2 | # Copyright (c) 2007-2009 Sullivan Beck. All rights reserved. | ||||||||||||||||||||||||||||||||
| 3 | # This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||
| 4 | # under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | 1 | $VERSION = "3.00"; | |||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 1 | require 5.004; | |||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use base qw( Template::Plugin ); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Template; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Template::Plugin; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 19 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | # sub sources { | ||||||||||||||||||||||||||||||||
| 22 | # shift; | ||||||||||||||||||||||||||||||||
| 23 | # my $obj = shift; | ||||||||||||||||||||||||||||||||
| 24 | # my @ret = $obj->sources(); | ||||||||||||||||||||||||||||||||
| 25 | # @ret = () if (! @ret); | ||||||||||||||||||||||||||||||||
| 26 | # return [ @ret ]; | ||||||||||||||||||||||||||||||||
| 27 | # } | ||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub eles { | ||||||||||||||||||||||||||||||
|
Subroutine
eles: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 32 | 0 | shift; | |||||||||||||||||||||||||||||||
| 33 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||
| 34 | 0 | my @ret = $obj->eles(); | |||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | @ret = () if (! @ret); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 36 | 0 | return [ @ret ]; | |||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | # sub eles_in_source { | ||||||||||||||||||||||||||||||||
| 40 | # shift; | ||||||||||||||||||||||||||||||||
| 41 | # my $obj = shift; | ||||||||||||||||||||||||||||||||
| 42 | # my $source = shift; | ||||||||||||||||||||||||||||||||
| 43 | # my @ret = $obj->eles_in_source($source); | ||||||||||||||||||||||||||||||||
| 44 | # @ret = () if (! @ret); | ||||||||||||||||||||||||||||||||
| 45 | # return [ @ret ]; | ||||||||||||||||||||||||||||||||
| 46 | # } | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | # sub ele_in_sources { | ||||||||||||||||||||||||||||||||
| 49 | # shift; | ||||||||||||||||||||||||||||||||
| 50 | # my $obj = shift; | ||||||||||||||||||||||||||||||||
| 51 | # my $ele = shift; | ||||||||||||||||||||||||||||||||
| 52 | # my @ret = $obj->ele_in_sources($ele); | ||||||||||||||||||||||||||||||||
| 53 | # @ret = () if (! @ret); | ||||||||||||||||||||||||||||||||
| 54 | # return [ @ret ]; | ||||||||||||||||||||||||||||||||
| 55 | # } | ||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||
| 57 | # sub ele_in_source { | ||||||||||||||||||||||||||||||||
| 58 | # shift; | ||||||||||||||||||||||||||||||||
| 59 | # my $obj = shift; | ||||||||||||||||||||||||||||||||
| 60 | # my $source = shift; | ||||||||||||||||||||||||||||||||
| 61 | # my $ele = shift; | ||||||||||||||||||||||||||||||||
| 62 | # my $ret = $obj->ele_in_source($source,$ele); | ||||||||||||||||||||||||||||||||
| 63 | # $ret = "" if (! defined $ret); | ||||||||||||||||||||||||||||||||
| 64 | # return $ret; | ||||||||||||||||||||||||||||||||
| 65 | # } | ||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub ele { | ||||||||||||||||||||||||||||||
|
Subroutine
ele: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 68 | 0 | shift; | |||||||||||||||||||||||||||||||
| 69 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||
| 70 | 0 | my $ele = shift; | |||||||||||||||||||||||||||||||
| 71 | 0 | my $ret = $obj->ele($ele); | |||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | $ret = "" if (! defined $ret); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 73 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub value { | ||||||||||||||||||||||||||||||
|
Subroutine
value: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 79 | 0 | shift; | |||||||||||||||||||||||||||||||
| 80 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||
| 81 | 0 | my $ele = shift; | |||||||||||||||||||||||||||||||
| 82 | 0 | my $path = shift; | |||||||||||||||||||||||||||||||
| 83 | 0 | my $ret = $obj->value($ele,$path); | |||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $ret = "" if (! defined $ret || ref($ret)); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $ret or ref $ret
MC/DC0%0/2
not defined $ret or ref $ret
not defined $ret
ref $ret
Truth table0%0/3
not(A) or B
A= not defined $retB= ref $ret
| |||||||||||||||||||||||||||||||||
| 85 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub values { | ||||||||||||||||||||||||||||||
|
Subroutine
values: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||
| 89 | 0 | shift; | |||||||||||||||||||||||||||||||
| 90 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||
| 91 | 0 | my $ele = shift; | |||||||||||||||||||||||||||||||
| 92 | 0 | my $path = shift; | |||||||||||||||||||||||||||||||
| 93 | 0 | my @val = $obj->values($ele,$path); | |||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | @val = () if (! @val); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 95 | 0 | my @ret; | |||||||||||||||||||||||||||||||
| 96 | 0 | foreach my $val (@val) { | |||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if (defined $val && ref($val)) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $val and ref $val
MC/DC0%0/2
defined $val and ref $val
defined $val
ref $val
Truth table0%0/3
A and B
A= defined $valB= ref $val
| |||||||||||||||||||||||||||||||||
| 98 | 0 | push(@ret,ref($val)); | |||||||||||||||||||||||||||||||
| 99 | ▶ | } elsif (defined $val && $val ne "") { | |||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $val and $val ne ""
MC/DC0%0/2
defined $val and $val ne ""
defined $val
$val ne ""
Truth table0%0/3
A and B
A= defined $valB= $val ne ""
| |||||||||||||||||||||||||||||||||
| 100 | 0 | push(@ret,$val); | |||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||
| 103 | 0 | return [ @ret ]; | |||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub keys { | ||||||||||||||||||||||||||||||
|
Subroutine
keys: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 107 | 0 | shift; | |||||||||||||||||||||||||||||||
| 108 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||
| 109 | 0 | my $ele = shift; | |||||||||||||||||||||||||||||||
| 110 | 0 | my $path = shift; | |||||||||||||||||||||||||||||||
| 111 | 0 | my @key = $obj->keys($ele,$path); | |||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | @key = () if (! @key); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 113 | 0 | my @ret; | |||||||||||||||||||||||||||||||
| 114 | 0 | foreach my $key (@key) { | |||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | push(@ret,$key) if (defined $key && $key ne ""); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $key and $key ne ""
MC/DC0%0/2
defined $key and $key ne ""
defined $key
$key ne ""
Truth table0%0/3
A and B
A= defined $keyB= $key ne ""
| |||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||
| 117 | 0 | return [ @ret ]; | |||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub which { | ||||||||||||||||||||||||||||||
|
Subroutine
which: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 123 | 0 | shift; | |||||||||||||||||||||||||||||||
| 124 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||
| 125 | 0 | my @ret = $obj->which(@_); | |||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | @ret = () if (! @ret); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 127 | 0 | return [ @ret ]; | |||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | ############################################################################### | ||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | # sub which_sources { | ||||||||||||||||||||||||||||||||
| 133 | # shift; | ||||||||||||||||||||||||||||||||
| 134 | # my $obj = shift; | ||||||||||||||||||||||||||||||||
| 135 | # my @ret = $obj->which_sources(@_); | ||||||||||||||||||||||||||||||||
| 136 | # @ret = () if (! @_ || $ret[0] == 0); | ||||||||||||||||||||||||||||||||
| 137 | # shift(@ret) if (@ret); | ||||||||||||||||||||||||||||||||
| 138 | # return [ @ret ]; | ||||||||||||||||||||||||||||||||
| 139 | # } | ||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||
| 141 | 1 | 1; | |||||||||||||||||||||||||||||||
| 142 | # Local Variables: | ||||||||||||||||||||||||||||||||
| 143 | # mode: cperl | ||||||||||||||||||||||||||||||||
| 144 | # indent-tabs-mode: nil | ||||||||||||||||||||||||||||||||
| 145 | # cperl-indent-level: 3 | ||||||||||||||||||||||||||||||||
| 146 | # cperl-continued-statement-offset: 2 | ||||||||||||||||||||||||||||||||
| 147 | # cperl-continued-brace-offset: 0 | ||||||||||||||||||||||||||||||||
| 148 | # cperl-brace-offset: 0 | ||||||||||||||||||||||||||||||||
| 149 | # cperl-brace-imaginary-offset: 0 | ||||||||||||||||||||||||||||||||
| 150 | # cperl-label-offset: -2 | ||||||||||||||||||||||||||||||||
| 151 | # End: | ||||||||||||||||||||||||||||||||