| 1 | # ============================================================================ | ||||||||||||||||||||||||||||||||||||||||||
| 2 | package MooseX::App::Plugin::Depends::Meta::Class; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # ============================================================================ | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | around 'command_check_attributes' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.5
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | my ($orig, $self, $command_meta, $errors, $params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | $command_meta ||= $self; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$command_meta ||= $self
MC/DC0%0/2
$command_meta ||= $self
$command_meta
$self
Truth table33%1/3
A ||= B
A= $command_metaB= $self
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | ATTR: | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | foreach my $attribute ( $self->command_usage_attributes($command_meta, 'all') ) { | |||||||||||||||||||||||||||||||||||||||||
| 14 | next ATTR | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 30 | ▶ | unless defined $params->{ $attribute->cmd_name_primary }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | next ATTR | ||||||||||||||||||||||||||||||||||||||||||
| 17 | unless $attribute->can('depends') | ||||||||||||||||||||||||||||||||||||||||||
| 18 | && ref($attribute->depends) eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 13 | ▶ | && scalar @{ $attribute->depends } > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$attribute->can("depends") and ref $attribute->depends eq "ARRAY" and scalar @{$attribute->depends;} > 0
$attribute->can("depends") and ref $attribute->depends eq "ARRAY"
MC/DC33%1/3
$attribute->can("depends") and ref $attribute->depends eq "ARRAY" and scalar @{$attribute->depends;} > 0
$attribute->can("depends")
ref $attribute->depends eq "ARRAY"
scalar @{$attribute->depends;} > 0
Truth table50%2/4
A and B and C
A= $attribute->can("depends")B= ref $attribute->depends eq "ARRAY"C= scalar @{$attribute->depends;} > 0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | OPT: | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 8 | foreach my $required_option ( @{ $attribute->depends } ) { | |||||||||||||||||||||||||||||||||||||||||
| 23 | next OPT | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 8 | ▶ | if defined $params->{$required_option}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | my $error_msg = "Option " | |||||||||||||||||||||||||||||||||||||||||
| 27 | . "'" . $attribute->cmd_name_primary . "'" | ||||||||||||||||||||||||||||||||||||||||||
| 28 | . " requires '$required_option' to be defined"; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | push @$errors, | |||||||||||||||||||||||||||||||||||||||||
| 31 | $self->command_message( | ||||||||||||||||||||||||||||||||||||||||||
| 32 | header => $error_msg, | ||||||||||||||||||||||||||||||||||||||||||
| 33 | type => 'error', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | return $self->$orig($command_meta, $errors, $params); | |||||||||||||||||||||||||||||||||||||||||
| 39 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||