File Coverage

blib/lib/Plack/Middleware/Profiler/KYTProf/Profile/TemplateEngine.pm
Criterion Covered Total %
statement 21 32 65.6
branch n/a
condition n/a
subroutine 8 13 61.5
pod 0 1 0.0
total 29 46 63.0


line stmt bran cond sub pod time code
1             package Plack::Middleware::Profiler::KYTProf::Profile::TemplateEngine;
2 2     2   4303 use strict;
  2         5  
  2         232  
3 2     2   11 use warnings;
  2         4  
  2         1142  
4              
5             sub load {
6 1     1 0 2 my $class = shift;
7 1         5 $class->_add_template_engine_profs;
8             }
9              
10             sub _add_template_engine_profs {
11 1     1   2 my $class = shift;
12 1         3 $class->_add_xslate_prof;
13 1         567 $class->_add_tt2_prof;
14 1         39000 $class->_add_template_pro_prof;
15 1         726 $class->_add_mojo_template_prof;
16             }
17              
18             sub _add_xslate_prof {
19 1     1   3 my $class = shift;
20              
21             Devel::KYTProf->add_prof(
22             "Text::Xslate",
23             "render",
24             sub {
25 0     0   0 my ( $orig, $self, $file, $args ) = @_;
26             return [
27 0         0 '%s %s',
28             ["render_method", "file"],
29             {
30             "render_method" => "render",
31             "file" => $file
32             },
33             ];
34             }
35 1         14 );
36             }
37              
38             sub _add_tt2_prof {
39 1     1   3 my $class = shift;
40             Devel::KYTProf->add_prof(
41             "Template",
42             "process",
43             sub {
44 0     0   0 my ( $orig, $class, $file, $args ) = @_;
45             return [
46 0         0 '%s %s',
47             ["render_method", "file"],
48             {
49             "render_method" => "process",
50             "file" => $file
51             },
52             ];
53             }
54 1         7 );
55             }
56              
57             sub _add_mojo_template_prof {
58             Devel::KYTProf->add_prof(
59             "Mojo::Template",
60             "render_file",
61             sub {
62 0     0   0 my ( $orig, $class, $file, $args ) = @_;
63             return [
64 0         0 '%s %s',
65             ["render_method", "file"],
66             {
67             "render_method" => "render_file",
68             "file" => $file
69             },
70             ];
71              
72             }
73 1     1   10 );
74              
75             Devel::KYTProf->add_prof(
76             "Mojo::Template",
77             "render",
78             sub {
79 0     0   0 my ( $orig, $class, $args ) = @_;
80              
81             return [
82 0         0 '%s',
83             ["render_method"],
84             {
85             "render_method" => "render",
86             },
87             ];
88             }
89 1         520 );
90              
91             }
92              
93             sub _add_template_pro_prof {
94 1     1   3 my $class = shift;
95             Devel::KYTProf->add_prof(
96             "HTML::Template::Pro",
97             "output",
98             sub {
99 0     0     my ( $orig, $class, $args ) = @_;
100 0           return sprintf '%s', "output";
101              
102             return [
103 0           '%s',
104             ["render_method"],
105             {
106             "render_method" => "output",
107             },
108             ]
109             }
110 1         9 );
111             }
112              
113             1;