lib/Serge/Command.pm

filter: Statementstmt 33.3% 7 / 21 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 4 totaltotal 24.3% 9 / 37 SCAR 23.5
CC
4
Cov
26%
validate_data
12.0
new
6.0
get_commands
2.0
CRAP 10.5
« lib/Serge/Config.pm ↑ Summary lib/Serge/Engine/Plugin/trademarks.pm »
1 package Serge::Command;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 sub get_commands {
6 0 ▶ die "get_commands() method must be redeclared in the ancestor class";
Subroutine get_commands: not called CC=1 SCAR=6.9
Pod undocumented
7  
8 # Example:
9 #
10 # return {
11 # foo => {handler => \&run_foo},
12 # bar => {handler => \&run_bar, need_config => 1},
13 # }
14 #
15 # where
16 # need_config: set to true value if the command requires configuration files to run against
17 # handler: code reference to a subroutine that handles the command logic
18 }
19  
20 sub new {
21 0 ▶ my ($class, $parent) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
22  
23 0 ▶ die "parent not specified" unless $parent;
Branch: 1 branch
BranchTrueFalseTotal
unless $parent 0 0 0
24  
25 0 my $self = {
26 parent => $parent
27 };
28  
29 0 bless($self, $class);
30 0 return $self;
31 }
32  
33 sub init {
34 0 ▶ my ($self) = @_;
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
35 # do nothing
36 }
37  
38 sub validate_data {
39 0 ▶ my ($self) = @_;
Subroutine validate_data: not called CC=3 SCAR=24.8
Pod undocumented
40  
41 # check if some unparsed --parameters are present in arguments
42  
43 0 my @unknown_params;
44 map {
45 0 ▶ push @unknown_params, $_ if ($_ =~ m/^--/);
Branch: 1 branch
BranchTrueFalseTotal
if $_ =~ /^--/ 0 0 0
46 } @ARGV;
47  
48 0 ▶ if (scalar @unknown_params) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @unknown_params) 0 0 0
49 0 my $message = join("', '", sort @unknown_params);
50 0 die "Unknown parameters: '$message'\n";
51 }
52 }
53  
54 1 1;
« lib/Serge/Config.pm ↑ Summary lib/Serge/Engine/Plugin/trademarks.pm »