Utils/OTRS3.pm

filter: Statementstmt 93.7% 15 / 16 Branchbran 50.0% 2 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 4 / 4 Podpod 100% 2 / 2 totaltotal 89.6% 26 / 29 CC 4 SCAR 10.4
CC
4
Cov
86%
packagesetup
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Command/sopm.pm ↑ Summary Utils/OTRS4.pm »
1 package OPM::Maker::Utils::OTRS3;
2 33 $OPM::Maker::Utils::OTRS3::VERSION = '1.2.0';
3 # ABSTRACT: Provide helper functions for OTRS <= 3
4  
5 33 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 33 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 ▶sub packagesetup {
Subroutine packagesetup: called CC=4 SCAR=14.3
Pod documented
9 8 my ($class, $type, $version, $function, $runtype, $package) = @_;
10  
11 8 ▶ $version = $version ? ' Version="' . $version . '"' : '';
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 0 8 8
12  
13 8 ▶ $runtype //= 'post';
Condition100%2/2
$runtype //= "post"
l!l
35
MC/DC100%1/1
$runtype //= "post"
$runtype
Truth table100%2/2
A
A= $runtype
Aresult
11
00
14  
15 8 ▶ if ( $package ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($package) { } 0 8 8
16 0 $package = sprintf "'%s'", $package;
17 }
18 else {
19 8 $package = '$Param{Structure}->{Name}->{Content}';
20 }
21  
22 8 return qq~ <$type Type="$runtype"$version><![CDATA[
23 # define function name
24 my \$FunctionName = '$function';
25  
26 # create the package name
27 my \$CodeModule = 'var::packagesetup::' . $package;
28  
29 # load the module
30 if ( \$Self->{MainObject}->Require(\$CodeModule) ) {
31  
32 # create new instance
33 my \$CodeObject = \$CodeModule->new( %{\$Self} );
34  
35 if (\$CodeObject) {
36  
37 # start methode
38 if ( !\$CodeObject->\$FunctionName(%{\$Self}) ) {
39 \$Self->{LogObject}->Log(
40 Priority => 'error',
41 Message => "Could not call method \$FunctionName() on \$CodeModule.pm."
42 );
43 }
44 }
45  
46 # error handling
47 else {
48 \$Self->{LogObject}->Log(
49 Priority => 'error',
50 Message => "Could not call method new() on \$CodeModule.pm."
51 );
52 }
53 }
54  
55 ]]></$type>~;
56 }
57  
58 23 ▶sub filecheck {
Subroutine filecheck: called CC=1 SCAR=0.0
Pod documented
59 23 return 1;
60 }
61  
62 33 1;
63  
64 __END__
« Command/sopm.pm ↑ Summary Utils/OTRS4.pm »