| 1 | package CGI::OptimalQuery::InteractiveQuery2Tools; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | no warnings qw( uninitialized ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use base 'CGI::OptimalQuery::Base'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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}->($$o{httpHeader}->('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}->($$o{httpHeader}->('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; | ||