blib/lib/CGI/OptimalQuery/InteractiveQuery2Tools.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 36 SCAR 30.0
CC
4
Cov
0%
output
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 20.0
1 package CGI::OptimalQuery::InteractiveQuery2Tools;
2  
3 use strict;
4 use warnings;
5 no warnings qw( uninitialized );
6 use base 'CGI::OptimalQuery::Base';
7  
8 sub output {
9 my $o = shift;
10  
11 # if request to open tool panel, execute tool on_open function
12 if ($$o{q}->param('tool') ne '') {
13 my $openedtool = $$o{q}->param('tool');
14 my $tool = $$o{schema}{tools}{$openedtool};
15 if (! $tool || ! $$tool{on_open}) {
16 $$o{output_handler}->(CGI::header('text/html')."<!DOCTYPE html>\n<html><body>could not find tool</body></html>");
17 } else {
18 my $buf = $$tool{on_open}->($o);
19 $$o{output_handler}->(CGI::header('text/html')."<!DOCTYPE html>\n<html><body>$buf</body></html>") if $buf;
20 }
21 }
22  
23 # else noop, trust that a tool on_init function has already responded
24  
25 return undef;
26 }
27  
28 1;