-my ($output, $output_wrong);
-
-if ($format =~ /json/) {
- $r->content_type($ctype or $format);
- $output= sub { print to_json_shim({
- success => 1,
- show => length $canontext ? encode_entities($canontext)
- : ' ',
- })};
- $output_wrong= sub { print to_json_shim({
- success => 0,
- show => $_[0],
- })};
-}
-if ($format =~ /return/) {
- $output= sub { return { Error => '', Results => \@results }; };
- $output_wrong= sub { return { Error => $_[0] }; };
-}
-if ($format =~ /dump/) {
- $r->content_type('text/plain');
- $output_wrong= sub { print Dumper(\@_); };
- $output= sub { print Dumper(\@results, $canontext); };
-}