| 1 | package BioX::Workflow::Command::run::Rules::Directives; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Moose::Util qw/apply_all_roles/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::HPC'; | ||||||||||||||||||||||||||||
| 9 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::Path'; | ||||||||||||||||||||||||||||
| 10 | #with 'BioX::Workflow::Command::run::Rules::Directives::Types::List'; | ||||||||||||||||||||||||||||
| 11 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::Stash'; | ||||||||||||||||||||||||||||
| 12 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::Hash'; | ||||||||||||||||||||||||||||
| 13 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::Array'; | ||||||||||||||||||||||||||||
| 14 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::CSV'; | ||||||||||||||||||||||||||||
| 15 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::Glob'; | ||||||||||||||||||||||||||||
| 16 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::Config'; | ||||||||||||||||||||||||||||
| 17 | with 'BioX::Workflow::Command::run::Rules::Directives::Types::Mustache'; | ||||||||||||||||||||||||||||
| 18 | with 'BioX::Workflow::Command::run::Rules::Directives::Interpolate'; | ||||||||||||||||||||||||||||
| 19 | with 'BioX::Workflow::Command::run::Rules::Directives::Functions'; | ||||||||||||||||||||||||||||
| 20 | with 'BioX::Workflow::Command::run::Rules::Directives::Sample'; | ||||||||||||||||||||||||||||
| 21 | with 'BioX::Workflow::Command::run::Rules::Directives::Walk'; | ||||||||||||||||||||||||||||
| 22 | with 'BioX::Workflow::Command::Utils::Log'; | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head2 Other Directives | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =cut | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | has '_ERROR' => ( | ||||||||||||||||||||||||||||
| 31 | is => 'rw', | ||||||||||||||||||||||||||||
| 32 | default => 0, | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | has 'register_types' => ( | ||||||||||||||||||||||||||||
| 36 | traits => [ 'Hash' ], | ||||||||||||||||||||||||||||
| 37 | is => 'rw', | ||||||||||||||||||||||||||||
| 38 | isa => 'HashRef', | ||||||||||||||||||||||||||||
| 39 | default => sub {return {}}, | ||||||||||||||||||||||||||||
| 40 | handles => { | ||||||||||||||||||||||||||||
| 41 | 'get_register_types' => 'get', | ||||||||||||||||||||||||||||
| 42 | 'set_register_types' => 'set', | ||||||||||||||||||||||||||||
| 43 | }, | ||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | has 'register_process_directives' => ( | ||||||||||||||||||||||||||||
| 47 | traits => [ 'Hash' ], | ||||||||||||||||||||||||||||
| 48 | is => 'rw', | ||||||||||||||||||||||||||||
| 49 | isa => 'HashRef', | ||||||||||||||||||||||||||||
| 50 | default => sub {return {}}, | ||||||||||||||||||||||||||||
| 51 | handles => { | ||||||||||||||||||||||||||||
| 52 | # 'get_register_process_directives' => 'get', | ||||||||||||||||||||||||||||
| 53 | 'set_register_process_directives' => 'set', | ||||||||||||||||||||||||||||
| 54 | }, | ||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =head3 register_namespace | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | A user can define their own custom types and processes. | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | has 'register_namespace' => ( | ||||||||||||||||||||||||||||
| 64 | traits => [ 'Array' ], | ||||||||||||||||||||||||||||
| 65 | is => 'rw', | ||||||||||||||||||||||||||||
| 66 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||
| 67 | default => sub {[]}, | ||||||||||||||||||||||||||||
| 68 | handles => { | ||||||||||||||||||||||||||||
| 69 | 'all_register_namespace' => 'elements', | ||||||||||||||||||||||||||||
| 70 | 'count_register_namespace' => 'count', | ||||||||||||||||||||||||||||
| 71 | 'has_register_namespace' => 'count', | ||||||||||||||||||||||||||||
| 72 | 'has_no_register_namespace' => 'is_empty', | ||||||||||||||||||||||||||||
| 73 | }, | ||||||||||||||||||||||||||||
| 74 | trigger => sub { | ||||||||||||||||||||||||||||
| 75 | my $self = shift; | ||||||||||||||||||||||||||||
| 76 | foreach my $role ($self->all_register_namespace) { | ||||||||||||||||||||||||||||
| 77 | try { | ||||||||||||||||||||||||||||
| 78 | apply_all_roles($self, $role); | ||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | catch { | ||||||||||||||||||||||||||||
| 81 | $self->app_log->warn( | ||||||||||||||||||||||||||||
| 82 | 'There was an error registering role ' . $role); | ||||||||||||||||||||||||||||
| 83 | $self->app_log->warn($@ . "\n"); | ||||||||||||||||||||||||||||
| 84 | }; | ||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | }, | ||||||||||||||||||||||||||||
| 87 | ); | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | has 'template_type' => ( | ||||||||||||||||||||||||||||
| 90 | is => 'rw', | ||||||||||||||||||||||||||||
| 91 | isa => 'Str', | ||||||||||||||||||||||||||||
| 92 | default => 'Text', | ||||||||||||||||||||||||||||
| 93 | documentation => 'BioX supports two templating engines out of the box -' | ||||||||||||||||||||||||||||
| 94 | . ' Text::Template and Template::Mustache. Default is Text.' | ||||||||||||||||||||||||||||
| 95 | . 'You can register another type by registering the namespace of your templating engine.' | ||||||||||||||||||||||||||||
| 96 | . 'It is not recommended to mix and match templating engines.' | ||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | has 'override_process' => ( | ||||||||||||||||||||||||||||
| 100 | traits => [ 'Bool' ], | ||||||||||||||||||||||||||||
| 101 | is => 'rw', | ||||||||||||||||||||||||||||
| 102 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 103 | default => 0, | ||||||||||||||||||||||||||||
| 104 | predicate => 'has_override_process', | ||||||||||||||||||||||||||||
| 105 | documentation => | ||||||||||||||||||||||||||||
| 106 | q(Instead of for my $sample (@sample){ DO STUFF } just DOSTUFF), | ||||||||||||||||||||||||||||
| 107 | handles => { | ||||||||||||||||||||||||||||
| 108 | set_override_process => 'set', | ||||||||||||||||||||||||||||
| 109 | clear_override_process => 'unset', | ||||||||||||||||||||||||||||
| 110 | }, | ||||||||||||||||||||||||||||
| 111 | ); | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =head2 data_loop | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | This has always been a hard coded as | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | for samples @samples | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | But it should be configurable | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | =cut | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | has 'data_loop' => ( | ||||||||||||||||||||||||||||
| 124 | is => 'rw', | ||||||||||||||||||||||||||||
| 125 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||
| 126 | documentation => 'Data Structure loop - Usually for samples @samples', | ||||||||||||||||||||||||||||
| 127 | default => sub { | ||||||||||||||||||||||||||||
| 128 | return [ {key => 'sample', value => 'samples'} ]; | ||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | ); | ||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | has 'run_stats' => ( | ||||||||||||||||||||||||||||
| 133 | is => 'rw', | ||||||||||||||||||||||||||||
| 134 | isa => 'Bool', | ||||||||||||||||||||||||||||
| 135 | default => 0, | ||||||||||||||||||||||||||||
| 136 | ); | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | ##Add in support for chunks | ||||||||||||||||||||||||||||
| 139 | ##This is useful for features where we want to do things like | ||||||||||||||||||||||||||||
| 140 | ##split a file into parts | ||||||||||||||||||||||||||||
| 141 | ##count by kmers, etc | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | =head3 create_attr | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | Add attributes to $self-> namespace | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =cut | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub create_attr { | ||||||||||||||||||||||||||
|
Subroutine
create_attr: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||
| 150 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 151 | 0 | my $data = shift; | |||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | my $meta = __PACKAGE__->meta; | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | $meta->make_mutable; | |||||||||||||||||||||||||||
| 156 | 0 | my $seen = {}; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | for my $attr ($meta->get_all_attributes) { | |||||||||||||||||||||||||||
| 159 | 0 | ▶ | next if $attr->name eq 'stash'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | 0 | $seen->{ $attr->name } = 1; | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | # Get workflow_data structure | ||||||||||||||||||||||||||||
| 164 | # Workflow is an array of hashes | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | foreach my $href (@{$data}) { | |||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if (!ref($href) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | ##TODO add more informative structure options here | ||||||||||||||||||||||||||||
| 170 | ##TODO Add app_log | ||||||||||||||||||||||||||||
| 171 | 0 | warn 'Your variable declarations should be key/value!'; | |||||||||||||||||||||||||||
| 172 | 0 | return; | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | while (my ($k, $v) = each(%{$href})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if (!exists $seen->{$k}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ($k eq 'stash') { | ||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||
| 180 | 0 | $self->merge_stash($v); | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | elsif ($self->can($k)) { | ||||||||||||||||||||||||||||
| 183 | 0 | next; | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | elsif ($self->search_registered_types($meta, $k, $v)) { | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | # next; | ||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | elsif (ref($v) eq 'HASH') { | ||||||||||||||||||||||||||||
| 190 | 0 | $self->create_HASH_attr($meta, $k); | |||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | elsif (ref($v) eq 'ARRAY') { | ||||||||||||||||||||||||||||
| 193 | 0 | $self->create_ARRAY_attr($meta, $k); | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | else { | ||||||||||||||||||||||||||||
| 196 | 0 | $self->create_reg_attr($meta, $k); | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 0 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | $self->$k($v) if defined $v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | 0 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 204 | 0 | $self->app_log->warn('There was an assiging key. ' . $k); | |||||||||||||||||||||||||||
| 205 | 0 | $self->app_log->warn("$_\n"); | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 0 | } | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 0 | $meta->make_immutable; | |||||||||||||||||||||||||||
| 212 | 0 | $self->apply_interpolate_role; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | sub create_reg_attr { | ||||||||||||||||||||||||||
|
Subroutine
create_reg_attr: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 216 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 217 | 0 | my $meta = shift; | |||||||||||||||||||||||||||
| 218 | 0 | my $k = shift; | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 0 | $meta->add_attribute( | |||||||||||||||||||||||||||
| 221 | $k => ( | ||||||||||||||||||||||||||||
| 222 | is => 'rw', | ||||||||||||||||||||||||||||
| 223 | lazy_build => 1, | ||||||||||||||||||||||||||||
| 224 | ) | ||||||||||||||||||||||||||||
| 225 | ); | ||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | =head3 create_blank_attr | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | placeholder for some types | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | =cut | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub create_blank_attr { | ||||||||||||||||||||||||||
|
Subroutine
create_blank_attr: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 235 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 236 | 0 | my $meta = shift; | |||||||||||||||||||||||||||
| 237 | 0 | my $k = shift; | |||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 0 | $meta->add_attribute( | |||||||||||||||||||||||||||
| 240 | $k => ( | ||||||||||||||||||||||||||||
| 241 | is => 'rw', | ||||||||||||||||||||||||||||
| 242 | default => '', | ||||||||||||||||||||||||||||
| 243 | ) | ||||||||||||||||||||||||||||
| 244 | ); | ||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | =head3 search_registered_types | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | A user can register custom types through the plugin system of in the workflow with 'register_namespace'. | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | Namespaces must be Moose Roles. | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | See BioX::Workflow::Command::run::Rules::Types::CSV for more information | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | =cut | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | ##TODO Also lookup by type key | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub search_registered_types { | ||||||||||||||||||||||||||
|
Subroutine
search_registered_types: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||
| 260 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 261 | 0 | my $meta = shift; | |||||||||||||||||||||||||||
| 262 | 0 | my $k = shift; | |||||||||||||||||||||||||||
| 263 | 0 | my $v = shift; | |||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | 0 | foreach my $key (keys %{$self->register_types}) { | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | 0 | ▶ | next unless exists $self->register_types->{$key}->{lookup}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | next unless exists $self->register_types->{$key}->{builder}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 0 | my $lookup_ref = $self->register_types->{$key}->{lookup}; | |||||||||||||||||||||||||||
| 270 | 0 | my $builder = $self->register_types->{$key}->{builder}; | |||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | ## We look for keys one of two ways - either they have a pattern match or a declared type | ||||||||||||||||||||||||||||
| 273 | 0 | foreach my $lookup (@{$lookup_ref}) { | |||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ($k =~ m/$lookup/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | 0 | $self->$builder($meta, $k, $v); | |||||||||||||||||||||||||||
| 276 | 0 | return 1; | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | ##TODO This is kind of hacky.... | ||||||||||||||||||||||||||||
| 281 | 0 | ▶ | if (ref($v) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 282 | 0 | ▶ | if (exists $v->{type} && !ref($v->{type})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $v->{"type"} and not ref $v->{"type"}
MC/DC0%0/2
exists $v->{"type"} and not ref $v->{"type"}
exists $v->{"type"}
not ref $v->{"type"}
Truth table0%0/3
A and not(B)
A= exists $v->{"type"}B= not ref $v->{"type"}
| |||||||||||||||||||||||||||||
| 283 | 0 | ▶ | next unless check_type($v); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 284 | 0 | $self->$builder($meta, $k, $v); | |||||||||||||||||||||||||||
| 285 | 0 | return 1; | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | elsif (ref($v) eq 'ARRAY') { | ||||||||||||||||||||||||||||
| 289 | 0 | my $first = $v->[0]; | |||||||||||||||||||||||||||
| 290 | 0 | ▶ | if (ref($first) && ref($first) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $first and ref $first eq "HASH"
MC/DC0%0/2
ref $first and ref $first eq "HASH"
ref $first
ref $first eq "HASH"
Truth table0%0/3
A and B
A= ref $firstB= ref $first eq "HASH"
| |||||||||||||||||||||||||||||
| 291 | 0 | ▶ | next unless check_type($first); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 292 | 0 | $self->$builder($meta, $k, $v); | |||||||||||||||||||||||||||
| 293 | 0 | return 1; | |||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 0 | return 0; | |||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub check_type { | ||||||||||||||||||||||||||
|
Subroutine
check_type: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 303 | 0 | my $hash_ref = shift; | |||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 0 | ▶ | return unless exists $hash_ref->{type}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 306 | 0 | my $type = $hash_ref->{type}; | |||||||||||||||||||||||||||
| 307 | 0 | ▶ | return unless $type eq $hash_ref->{type}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 0 | return 1; | |||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub BUILD {} | ||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | after 'BUILD' => sub { | ||||||||||||||||||||||||||||
| 316 | my $self = shift; | ||||||||||||||||||||||||||||
| 317 | $self->interpol_directive_cache({}); | ||||||||||||||||||||||||||||
| 318 | }; | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | __PACKAGE__->meta->make_immutable; | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 1; | ||||||||||||||||||||||||||||