File Coverage

blib/lib/OTRS/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 OTRS::OPM::Maker::Utils::OTRS4;
2              
3             # ABSTRACT: helper functions for OTRS >= 4
4              
5 30     30   235 use strict;
  30         81  
  30         997  
6 30     30   171 use warnings;
  30         84  
  30         872  
7              
8 30     30   177 use List::Util qw(first);
  30         78  
  30         2001  
9 30     30   191 use Carp;
  30         78  
  30         10157  
10              
11             our $VERSION = 1.44;
12              
13             sub packagesetup {
14 21     21 1 81 my ($class, $type, $version, $function, $runtype, $package) = @_;
15              
16 21 100       64 $version = $version ? ' Version="' . $version . '"' : '';
17              
18 21   100     87 $runtype //= 'post';
19              
20 21 100       43 if ( $package ) {
21 2         7 $package = sprintf "'%s'", $package;
22             }
23             else {
24 19         32 $package = '$Param{Structure}->{Name}->{Content}';
25             }
26              
27 21         124 return qq~ <$type Type="$runtype"$version>
28             \$Kernel::OM->Get('var::packagesetup::' . $package )->$function();
29             ]]>~;
30             }
31              
32             sub filecheck {
33 12     12 1 33 my ($class, $files) = @_;
34              
35 12 100   43   49 if ( first{ $_ =~ m{Kernel/Output/HTML/[^/]+/.*?\.dtl\z} }@{$files} ) {
  43         94  
  12         61  
36 1         150 carp "The old template engine was replaced with Template::Toolkit. Please use bin/otrs.MigrateDTLToTT.pl.\n";
37             }
38              
39 12         93 return 1;
40             }
41              
42             1;
43              
44             __END__