Qgoda/Plugger/Inline.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 54 CC 2 SCAR 10.3
CC
2
Cov
0%
compile
6.0
new
2.0
language
2.0
CRAP 2.8
1 #! /bin/false
2  
3 # Copyright (C) 2016-2018 Guido Flohr <guido.flohr@cantanea.com>,
4 # all rights reserved.
5  
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10  
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15  
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18  
19 package Qgoda::Plugger::Inline;
20 $Qgoda::Plugger::Inline::VERSION = 'v0.9.2';
21 use strict;
22  
23 use Locale::TextDomain qw(qgoda);
24 use Inline;
25  
26 use Qgoda;
27  
28 use base qw(Qgoda::Plugger);
29  
30 sub new {
31 my ($class, $data) = @_;
32  
33 my $self = bless $data, $class;
34  
35 return $self;
36 }
37  
38 sub language {
39 my ($self) = @_;
40  
41 my $language = ref $self;
42 $language =~ s/^Qgoda::Plugger::Inline:://;
43  
44 return $language;
45 }
46  
47 sub compile {
48 my ($self) = @_;
49  
50 my $language = $self->language;
51  
52 my %config;
53  
54 if ($ENV{"QGODA_DEBUG_$language"}) {
55 $config{print_version} = 1;
56 $config{print_info} = 1;
57 }
58  
59 my $namespace = $self->{plugin_loader}->namespace($self);
60 require Data::Dumper;
61 my $args = Data::Dumper::Dumper([$self->{main}, %config]);
62 $args =~ s{.*?= \[}{};
63 $args =~ s{\];.*?$}{};
64  
65 return sub {
66 eval <<EOF;
67 package $namespace;
68  
69 Inline->bind($language => $args);
70  
71 \$SIG{INT} = 'DEFAULT';
72 EOF
73 };
74 }
75  
76 1;