line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
2
|
|
|
|
|
|
|
# Copyright (c) 2014, 2015 Yon |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Permission to use, copy, modify, and distribute this software for any |
5
|
|
|
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above |
6
|
|
|
|
|
|
|
# copyright notice and this permission notice appear in all copies. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9
|
|
|
|
|
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
10
|
|
|
|
|
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
11
|
|
|
|
|
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
12
|
|
|
|
|
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
13
|
|
|
|
|
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
14
|
|
|
|
|
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# Eval of perl code to compile new user defined macros |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
package Text::Frundis::PerlEval; |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
|
10
|
use utf8; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
10
|
|
21
|
3
|
|
|
3
|
|
73
|
use v5.12; |
|
3
|
|
|
|
|
6
|
|
22
|
3
|
|
|
3
|
|
7
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
46
|
|
23
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
68
|
|
24
|
3
|
|
|
3
|
|
8
|
use open qw(:std :utf8); |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
29
|
|
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
3
|
|
232
|
use Text::Frundis::Object qw(@Arg); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
235
|
|
27
|
3
|
|
|
3
|
|
11
|
use Text::Frundis::Processing; |
|
3
|
|
|
|
|
1
|
|
|
3
|
|
|
|
|
526
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @Arg; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _compile_perl_code { # [[[ |
32
|
63
|
|
|
63
|
|
53
|
my $self = shift; |
33
|
63
|
|
|
|
|
75
|
my ($macro, $text, $type) = @_; |
34
|
63
|
100
|
|
|
|
102
|
my $key = $type eq "macro" ? "macros" : "filters"; |
35
|
63
|
|
|
|
|
52
|
local $@; |
36
|
|
|
|
|
|
|
{ |
37
|
63
|
|
|
|
|
345
|
local $SIG{'__WARN__'} = sub { |
38
|
0
|
|
|
0
|
|
0
|
Text::Frundis::Processing::diag_error("perl_eval:$type:$_[0]"); |
39
|
63
|
|
|
|
|
343
|
}; |
40
|
63
|
|
|
1
|
|
6929
|
$self->{$key}{$macro}{code} = eval qq(sub { $text }); |
|
1
|
|
|
1
|
|
8
|
|
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
1
|
|
10
|
|
|
1
|
|
|
1
|
|
420
|
|
|
1
|
|
|
1
|
|
172
|
|
|
1
|
|
|
1
|
|
20
|
|
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
87
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
91
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
90
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
41
|
|
|
|
|
|
|
} |
42
|
63
|
50
|
|
|
|
261
|
if ($@) { |
43
|
0
|
|
|
|
|
0
|
Text::Frundis::Processing::diag_fatal("perl_eval:$type:$@"); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} # ]]] |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# vim:foldmarker=[[[,]]]:foldmethod=marker:sw=4:sts=4:expandtab |