Lazy/Widget/DomLoader.pm

filter: Statementstmt 33.3% 10 / 30 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 50.0% 1 / 2 totaltotal 34.1% 14 / 41 CC 5 SCAR 23.6
CC
5
Cov
29%
output
20.0
new
6.0
BEGIN
1.0
CRAP 10.6
« Lazy/DB.pm ↑ Summary Lazy/Config.pm »
1 package CGI::Lazy::Widget::DomLoader;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use base qw(CGI::Lazy::Widget);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #----------------------------------------------------------------------------------------
9 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
10 0 my $class = shift;
11 0 my $q = shift;
12 0 my $inputvars = shift;
13  
14 0 my $vars = {};
15  
16 0 foreach (keys %{$inputvars->{lookups}}) {
17 0 $vars->{lookups}->{$_} = $_;
18 0 $vars->{lookups}->{$_}->{preload} = 1;
19 }
20  
21 0 $vars->{raw} = $inputvars->{raw};
22  
23 0 my $widgetID = $vars->{id};
24 0 return bless {_q => $q, _vars => $vars, _widgetID => $widgetID}, $class;
25 }
26  
27 #----------------------------------------------------------------------------------------
28 0 ▶sub output {
Subroutine output: not called CC=4 SCAR=30.0
Pod documented
29 0 my $self = shift;
30  
31 0 my $rawObjectJs;
32  
33 0 foreach my $rawvar (keys %{$self->vars->{raw};}) {
34 0 $rawObjectJs .= "var $rawvar = JSON.parse('".to_json($self->vars->{raw}->{$rawvar})."');\n";
35 }
36  
37 0 ▶ $rawObjectJs = $self->q->jswrap($rawObjectJs) if $rawObjectJs;
Branch: 1 branch
BranchTrueFalseTotal
if $rawObjectJs 0 0 0
38  
39 0 my $output = $self->preloadLookup;
40 0 ▶ $output .= $rawObjectJs if $rawObjectJs;
Branch: 1 branch
BranchTrueFalseTotal
if $rawObjectJs 0 0 0
41  
42 0 return $output;
43 }
44  
45 1 1
46  
47 __END__
« Lazy/DB.pm ↑ Summary Lazy/Config.pm »