line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sandy::Role::RunTimeTemplate; |
2
|
|
|
|
|
|
|
# ABSTRACT: Extends class with runtime printf like function |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
6244
|
use App::Sandy::Base 'role'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
54
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.24'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub with_compile_template { |
9
|
14
|
|
|
14
|
0
|
149
|
my ($self, $template, $input_name, $sym_table) = @_; |
10
|
14
|
50
|
|
|
|
63
|
croak "sym_table is not a hashref" unless ref $sym_table eq 'HASH'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Inactivate perl reserved characters $, @, &, # |
13
|
14
|
|
|
|
|
59
|
$template =~ s/(?<!\\)[\$\@\#\&]/\\$&/g; |
14
|
|
|
|
|
|
|
|
15
|
14
|
|
|
|
|
120
|
while (my ($sym, $variable) = each %$sym_table) { |
16
|
343
|
|
|
|
|
3251
|
$template =~ s/$sym/$variable/g; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
## no critic |
20
|
|
|
|
|
|
|
|
21
|
14
|
|
|
|
|
3559
|
my $sub = eval "sub { my \$$input_name = shift; return \"$template\"; }"; |
22
|
14
|
50
|
|
|
|
91
|
die "Error compiling template '$template': $@" if $@; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
## use critic |
25
|
|
|
|
|
|
|
|
26
|
14
|
|
|
|
|
569
|
return $sub; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=pod |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=encoding UTF-8 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
App::Sandy::Role::RunTimeTemplate - Extends class with runtime printf like function |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 VERSION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
version 0.24 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 AUTHORS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item * |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Thiago L. A. Miller <tmiller@mochsl.org.br> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item * |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
J. Leonel Buzzo <lbuzzo@mochsl.org.br> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item * |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Felipe R. C. dos Santos <fsantos@mochsl.org.br> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item * |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Helena B. Conceição <hconceicao@mochsl.org.br> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item * |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Gabriela Guardia <gguardia@mochsl.org.br> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Fernanda Orpinelli <forpinelli@mochsl.org.br> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Rafael Mercuri <rmercuri@mochsl.org.br> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Rodrigo Barreiro <rbarreiro@mochsl.org.br> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Pedro A. F. Galante <pgalante@mochsl.org.br> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by Teaching and Research Institute from Sírio-Libanês Hospital. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This is free software, licensed under: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |