Branch Coverage

blib/lib/Dancer2/Plugin/WebService.pm
Criterion Covered Total %
branch 0 278 0.0


line true false branch
66 0 0 unless (-d $module_dir)
77 0 0 unless exists $plg->config->{'Default format'} and $plg->config->{'Default format'} =~ /$fmt_rgx/
85 0 0 unless exists $method->{'Active'} and $method->{'Active'} =~ /(?i)[y1t]/
89 0 0 if ($plg->auth_method ne "INTERNAL")
90 0 0 unless (exists $method->{'Command'})
92 0 0 unless (-f $method->{'Command'})
93 0 0 unless (-x $method->{'Command'})
95 0 0 if (exists $method->{'Use sudo'} and $method->{'Use sudo'} =~ /(?i)[y1t]/) { }
97 0 0 if (-f "$_/sudo" and -x "$_/sudo")
98 0 0 unless (defined $sudo)
115 0 0 if ($plg->session_enable and $plg->auth_method eq "")
122 0 0 if exists $plg->config->{'Routes'}{$_}{'Built in'}
125 0 0 if (exists $plg->config->{'Routes'}{$_}{'Protected'} and $plg->config->{'Routes'}{$_}{'Protected'} =~ /(?i)[y1t]/) { }
130 0 0 if ($plg->auth_method eq '') { }
136 0 0 if (exists $plg->config->{'Routes'}{$_}{'Groups'}) { }
138 0 0 unless "ARRAY" eq ref $plg->config->{'Routes'}{$_}{'Groups'}
157 0 0 $plg->auth_method ? :
161 0 0 $plg->session_enable ? :
164 0 0 exists $plg->dsl->config->{'appversion'} ? :
171 0 0 unless opendir DIR, $plg->dir_session
175 0 0 if (-f "$plg->{'dir_session'}/$token/control/lastaccess" and -f "$plg->{'dir_session'}/$token/control/username" and -f "$plg->{'dir_session'}/$token/control/groups") { }
178 0 0 if (time - $lastaccess > $plg->Session_timeout) { }
186 0 0 unless opendir __TOKEN, "$plg->{'dir_session'}/$token/data"
189 0 0 unless -f "$plg->{'dir_session'}/$token/data/$record"
192 0 0 if "SCALAR" eq ref $TokenDB{$token}{'data'}{$record}
237 0 0 $app->request->query_parameters->{'sort'} =~ /(?i)1|t|y/ ? :
0 0 exists $app->request->query_parameters->{'sort'} ? :
238 0 0 $app->request->query_parameters->{'pretty'} =~ /(?i)1|t|y/ ? :
0 0 exists $app->request->query_parameters->{'pretty'} ? :
244 0 0 if (exists $app->request->query_parameters->{$_}) { }
246 0 0 if ($app->request->query_parameters->{$_} =~ /$fmt_rgx/) { }
251 0 0 if ($app->request->query_parameters->{$_} eq 'jsn') { }
0 0 elsif ($app->request->query_parameters->{$_} eq 'yml') { }
0 0 elsif ($app->request->query_parameters->{$_} eq 'txt') { }
0 0 elsif ($app->request->query_parameters->{$_} eq 'text') { }
274 0 0 if ($plg->ClientIP =~ /$plg->rules_compiled->[$i]/)
279 0 0 if $plg->error
283 0 0 if ($app->request->{'route'}{'regexp'} =~ m<^\^[/\\]+(.*?)[/\\]+\(\?#token.*>) { }
0 0 elsif ($app->request->{'route'}{'regexp'} =~ m(^\^[/\\]+(.*?)\$)) { }
287 0 0 unless (exists $plg->config->{'Routes'}{$1})
294 0 0 if ($app->request->body)
298 0 0 if ('json' eq $plg->Format->{'from'}) { }
0 0 elsif ('yaml' eq $plg->Format->{'from'}) { }
0 0 elsif ('xml' eq $plg->Format->{'from'}) { }
0 0 elsif ('perl' eq $plg->Format->{'from'}) { }
0 0 elsif ('human' eq $plg->Format->{'from'}) { }
306 0 0 unless @array
308 0 0 if ($#array == 0) { }
320 0 0 if ($@)
333 0 0 if (exists $app->request->query_parameters->{'token'})
343 0 0 if ('HASH' eq ref $plg->data) { }
0 0 elsif ('ARRAY' eq ref $plg->data) { }
346 0 0 if (exists $plg->data->{'token'} and not defined $plg->token)
371 0 0 unless exists $plg->config->{'Routes'}{$plg->route_name} and $plg->config->{'Routes'}{$plg->route_name}{'Protected'} == 1
373 0 0 unless (defined $plg->token)
374 0 0 unless (exists $TokenDB{$plg->token})
377 0 0 if (time - $TokenDB{$plg->token}{'control'}{'lastaccess'} > $plg->Session_timeout) { }
395 0 0 if (exists $TokenDB{$plg->token}{'control'}{'groups'}{$_})
400 0 0 unless ($tmp)
422 0 0 $plg->auth_method ? :
0 0 exists $plg->dsl->config->{'appversion'} ? :
439 0 0 if ($app->request->param('what') =~ /(?i)\Ar/) { }
0 0 elsif ($app->request->param('what') =~ /(?i)\Ac/) { }
484 0 0 if -d $plg->dir_session . '/' . $plg->token
496 0 0 if ($plg->auth_method eq "")
499 0 0 unless (exists $plg->data->{$_})
500 0 0 if ($plg->data->{'username'} =~ /^\s*$/)
501 0 0 if ($plg->data->{'password'} eq "")
508 0 0 if ($plg->auth_method eq 'INTERNAL') { }
510 0 0 if (exists $plg->auth_config->{'Accounts'}{$plg->data->{'username'}})
511 0 0 if ($plg->auth_config->{'Accounts'}{$plg->data->{'username'}} eq '') { }
0 0 elsif ($plg->auth_config->{'Accounts'}{$plg->data->{'username'}} eq $plg->data->{'password'}) { }
515 0 0 if ($plg->error and exists $plg->auth_config->{'Accounts'}{''})
516 0 0 if ($plg->auth_config->{'Accounts'}{''} eq '') { }
0 0 elsif ($plg->auth_config->{'Accounts'}{''} eq $plg->data->{'password'}) { }
534 0 0 if (@{$plg->auth_config->{'Arguments'};})
537 0 0 unless open SHELL, "-|", "$command 2> /dev/null"
541 0 0 unless (2 == scalar @output)
546 0 0 if $plg->error
549 0 0 unless open URANDOM__, "<", "/dev/urandom"
558 0 0 unless (mkdir $_)
566 0 0 unless (Storable::lock_store(\$v, "$plg->{'dir_session'}/$tmp/control/$k"))
597 0 0 if ($#_ == -1) { }
0 0 elsif ($#_ == 0) { }
601 0 0 if (ref $_[0]) { }
602 0 0 if ('HASH' eq ref $_[0]) { }
0 0 elsif ('ARRAY' eq ref $_[0]) { }
0 0 elsif ('SCALAR' eq ref $_[0]) { }
0 0 elsif ('GLOB' eq ref $_[0]) { }
0 0 elsif ('CODE' eq ref $_[0]) { }
609 0 0 if (0 == $#keys) { }
610 0 0 if (ref $keys[0]) { }
611 0 0 if ('HASH' eq ref $keys[0]) { }
0 0 elsif ('ARRAY' eq ref $keys[0]) { }
0 0 elsif ('SCALAR' eq ref $keys[0]) { }
0 0 elsif ('GLOB' eq ref $keys[0]) { }
0 0 elsif ('CODE' eq ref $keys[0]) { }
651 0 0 if ($plg->Format->{'to'} eq 'json') { }
0 0 elsif ($plg->Format->{'to'} eq 'xml') { }
0 0 elsif ($plg->Format->{'to'} eq 'yaml') { }
0 0 elsif ($plg->Format->{'to'} eq 'human') { }
0 0 elsif ($plg->Format->{'to'} eq 'perl') { }
654 0 0 if ($plg->pretty) { }
661 0 0 if ($plg->Format->{'from'} eq 'human' or $plg->Format->{'from'} eq 'perl') { }
676 0 0 $plg->pretty ? :
686 0 0 if ($plg->Format->{'from'} eq 'human' or $plg->Format->{'from'} eq 'perl') { }
699 0 0 if ($plg->Format->{'from'} eq 'human' or $plg->Format->{'from'} eq 'perl') { }
708 0 0 if ($@)
726 0 0 if (@_)
728 0 0 if ('HASH' eq ref $plg->data) { }
0 0 elsif ('ARRAY' eq ref $plg->data) { }
0 0 elsif ('SCALAR' eq ref $plg->data) { }
732 0 0 unless exists $tmp->{$_}
741 0 0 if $_ eq ${$plg->data;}
742 0 0 if $_ eq $plg->data
761 0 0 if ($plg->session_enable) { }
763 0 0 if (defined $plg->token) { }
765 0 0 unless (exists $TokenDB{$plg->token})
780 0 0 if 1 == @_ and "HASH" eq ref $_[0]
786 0 0 if "token" eq $_[$k]
790 0 0 ref $_[$v] ? :
0 0 unless (Storable::lock_store(ref $_[$v] ? $_[$v] : \$_[$v], "$plg->{'dir_session'}/" . $plg->token . "/data/$_[$k]"))
809 0 0 if ($plg->session_enable) { }
811 0 0 if (defined $plg->token) { }
813 0 0 unless (exists $TokenDB{$plg->token})
828 0 0 if (0 == scalar @_) { }
0 0 elsif (1 == scalar @_) { }
835 0 0 if ('ARRAY' eq ref $_[0]) { }
837 0 0 exists $TokenDB{$plg->token}{'data'}{$_} ? :
840 0 0 exists $TokenDB{$plg->token}{'data'}{$_[0]} ? :
862 0 0 if ($plg->session_enable) { }
864 0 0 if (defined $plg->token) { }
866 0 0 unless (exists $TokenDB{$plg->token})
884 0 0 if (@_) { }
885 0 0 if 1 == @_ and "ARRAY" eq ref $_[0]
889 0 0 if (exists $TokenDB{$plg->token}{'data'}{$_})
892 0 0 if -f "$dir/data/$_"
901 0 0 if -f "$dir/data/$_"
914 0 0 exists $_[1] ? :