| 1 | package Rose::Object::MixIn; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | our $Debug = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | our $VERSION = '0.856'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | use Rose::Class::MakeMethods::Set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | inheritable_set => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | '_export_tag' => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | list_method => '_export_tags', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | clear_method => 'clear_export_tags', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | add_method => '_add_export_tag', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | delete_method => 'delete_export_tag', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | deletes_method => 'delete_export_tags', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | '_pre_import_hook', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | clear_method => 'clear_pre_import_hooks', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | add_method => 'add_pre_import_hook', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | adds_method => 'add_pre_import_hooks', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | delete_method => 'delete_pre_import_hook', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | deletes_method => 'delete_pre_import_hooks', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | sub import | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=19 SCAR=33.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 3 | my $target_class = (caller)[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | my($force, @methods, %import_as); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | foreach my $arg (@_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 7 | ▶ | if(!defined $target_class && $arg !~ /^-/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $target_class or $arg =~ /^-/
MC/DC50%1/2
defined $target_class or $arg =~ /^-/
defined $target_class
$arg =~ /^-/
Truth table66%2/3
A or B
A= defined $target_classB= $arg =~ /^-/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | $target_class = $arg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | if($arg =~ /^-?-force$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $force = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | elsif($arg =~ /^-?-target[-_]class$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | $target_class = undef; # set on next iteration...lame | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | elsif($arg =~ /^:(.+)/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | my $methods = $class->export_tag($1) or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | croak "Unknown export tag - '$arg'"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | push(@methods, @$methods); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | elsif(ref $arg eq 'HASH') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | while(my($method, $name) = each(%$arg)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | push(@methods, $method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | $import_as{$method} = $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2 | push(@methods, $arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 3 | foreach my $method (@methods) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 5 | ▶ | my $code = $class->can($method) or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | croak "Could not import method '$method' from $class - no such method"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 5 | ▶ | my $import_as = $import_as{$method} || $method; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$import_as{$method} || $method
MC/DC0%0/2
$import_as{$method} || $method
$import_as{$method}
$method
Truth table66%2/3
A || B
A= $import_as{$method}B= $method
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 5 | ▶ | if($target_class->can($import_as) && !$force) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$target_class->can($import_as) and not $force
MC/DC0%0/2
$target_class->can($import_as) and not $force
$target_class->can($import_as)
not $force
Truth table33%1/3
A and not(B)
A= $target_class->can($import_as)B= not $force
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | croak "Could not import method '$import_as' from $class into ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | "$target_class - a method by that name already exists. ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | "Pass a '-force' argument to import() to override ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | "existing methods." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 5 | ▶ | if(my $hooks = $class->pre_import_hooks($method)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 5 | foreach my $code (@$hooks) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my $error; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | TRY: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | eval { $code->($class, $method, $target_class, $import_as) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | if($error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | croak "Could not import method '$import_as' from $class into ", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | "$target_class - $error"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 5 | ▶ | $Debug && warn "${target_class}::$import_as = ${class}->$method\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 5 | *{$target_class . '::' . $import_as} = $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | sub export_tag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
export_tag: called CC=10 SCAR=26.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | my($class, $tag) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | ▶ | if(index($tag, ':') == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | croak 'Tag name arguments to export_tag() should not begin with ":"'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 4 | ▶ | if(@_ && !$class->_export_tag_value($tag)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@_ and not $class->_export_tag_value($tag)
MC/DC50%1/2
@_ and not $class->_export_tag_value($tag)
@_
not $class->_export_tag_value($tag)
Truth table66%2/3
A and not(B)
A= @_B= not $class->_export_tag_value($tag)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 3 | $class->_add_export_tag($tag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 4 | ▶ | if(@_ && (@_ > 1 || (ref $_[0] || '') ne 'ARRAY')) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%4/8
@_ and @_ > 1 || (ref $_[0] || "") ne "ARRAY"
@_ > 1 or (ref $_[0] || "") ne "ARRAY"
ref $_[0] || ''
MC/DC33%1/3
@_ and @_ > 1 || (ref $_[0] || "") ne "ARRAY"
@_
@_ > 1
ref $_[0]
Truth table50%2/4
A and B or C
A= @_B= @_ > 1C= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | croak 'export_tag() expects either a single tag name argument, ', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 'or a tag name and a reference to an array of method names'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 4 | my $ret = $class->_export_tag_value($tag, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | ▶ | croak "No such tag: $tag" unless($ret); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 4 | ▶ | return wantarray ? @$ret : $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | sub export_tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
export_tags: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | ▶ | return $class->_export_tags unless(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | $class->clear_export_tags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 2 | $class->add_export_tags(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | sub add_export_tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_export_tags: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 2 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 2 | ▶ | while(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 3 | my($tag, $arg) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 3 | $class->export_tag($tag, $arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | sub pre_import_hook | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pre_import_hook: called CC=12 SCAR=39.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 5 | my($class, $method) = (shift, shift); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 5 | ▶ | if(@_ && !$class->_pre_import_hook_value($method)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and not $class->_pre_import_hook_value($method)
MC/DC0%0/2
@_ and not $class->_pre_import_hook_value($method)
@_
not $class->_pre_import_hook_value($method)
Truth table33%1/3
A and not(B)
A= @_B= not $class->_pre_import_hook_value($method)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $class->add_pre_import_hook($method); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5 | ▶ | if(@_ && (@_ > 1 || (ref $_[0] && (ref $_[0] || '') !~ /\A(?:ARRAY|CODE)\z/))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition9%1/11
@_ and @_ > 1 || ref $_[0] && !((ref $_[0] || "") =~ /\A(?:ARRAY|CODE)\z/)
@_ > 1 or ref $_[0] and not +(ref $_[0] || "") =~ /\A(?:ARRAY|CODE)\z/
ref $_[0] and not +(ref $_[0] || "") =~ /\A(?:ARRAY|CODE)\z/
ref $_[0] || ''
MC/DC0%0/4
@_ and @_ > 1 || ref $_[0] && !((ref $_[0] || "") =~ /\A(?:ARRAY|CODE)\z/)
@_
@_ > 1
ref $_[0]
ref $_[0]
Truth table20%1/5
A and B or C and not(D)
A= @_B= @_ > 1C= ref $_[0]D= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | croak 'pre_import_hook() expects either a single method name argument, ', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 'or a method name and a code reference or a reference to an array ', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 'of code references'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 5 | ▶ | if(@_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | unless(ref $_[0] eq 'ARRAY') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $_[0] = [ $_[0] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 5 | ▶ | my $ret = $class->_pre_import_hook_value($method, @_) || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$class->_pre_import_hook_value($method, @_) || []
MC/DC0%0/1
$class->_pre_import_hook_value($method, @_) || []
$class->_pre_import_hook_value($method, @_)
Truth table50%1/2
A
A= $class->_pre_import_hook_value($method, @_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 5 | ▶ | return wantarray ? @$ret : $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 5 | ▶ | sub pre_import_hooks { shift->pre_import_hook(shift) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pre_import_hooks: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||