| 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
| |||||||||||||
| 12 | |||||||||||||
| 13 | 8 | ▶ | $runtype //= 'post'; | ||||||||||
|
Condition100%2/2
$runtype //= "post"
MC/DC100%1/1
$runtype //= "post"
$runtype
Truth table100%2/2
A
A= $runtype
| |||||||||||||
| 14 | |||||||||||||
| 15 | 8 | ▶ | if ( $package ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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__ | ||||||||||||