File Coverage

blib/lib/OPM/Maker/Utils/OTRS4.pm
Criterion Covered Total %
statement 25 25 100.0
branch 6 6 100.0
condition 2 2 100.0
subroutine 7 7 100.0
pod 2 2 100.0
total 42 42 100.0


line stmt bran cond sub pod time code
1             package OPM::Maker::Utils::OTRS4;
2             $OPM::Maker::Utils::OTRS4::VERSION = '1.1.0';
3             # ABSTRACT: helper functions for ((OTRS)) Community Edition >= 4
4              
5 33     33   260 use strict;
  33         76  
  33         1056  
6 33     33   175 use warnings;
  33         72  
  33         961  
7              
8 33     33   201 use List::Util qw(first);
  33         69  
  33         2234  
9 33     33   214 use Carp;
  33         81  
  33         10561  
10              
11             sub packagesetup {
12 21     21 1 88 my ($class, $type, $version, $function, $runtype, $package) = @_;
13              
14 21 100       62 $version = $version ? ' Version="' . $version . '"' : '';
15              
16 21   100     92 $runtype //= 'post';
17              
18 21 100       38 if ( $package ) {
19 2         8 $package = sprintf "'%s'", $package;
20             }
21             else {
22 19         34 $package = '$Param{Structure}->{Name}->{Content}';
23             }
24              
25 21         149 return qq~ <$type Type="$runtype"$version>
26             \$Kernel::OM->Get('var::packagesetup::' . $package )->$function();
27             ]]>~;
28             }
29              
30             sub filecheck {
31 13     13 1 43 my ($class, $files) = @_;
32              
33 13 100   46   56 if ( first{ $_ =~ m{Kernel/Output/HTML/[^/]+/.*?\.dtl\z} }@{$files} ) {
  46         100  
  13         85  
34 1         142 carp "The old template engine was replaced with Template::Toolkit. Please use bin/otrs.MigrateDTLToTT.pl.\n";
35             }
36              
37 13         100 return 1;
38             }
39              
40             1;
41              
42             __END__