}
sub _build_json {
- JSON->new->relaxed
+ JSON->new->relaxed->pretty
}
sub dispatch_request {
$tmp{join '|', keys %$_} = 1 for values %$data;
if (keys %tmp == 1) {
$data->{$_}->{name} ||= $_ for keys %$data;
+ my @cols = grep $_ ne 'name', sort keys %{(values %$data)[0]};
+ unshift @cols, 'name';
return {
- columns => [ sort keys %{(values %$data)[0]} ],
+ columns => \@cols,
show_columns => 1,
data => [ @{$data}{sort keys %$data} ],
}
return join(', ', @$part);
}
if (ref($part) eq 'HASH') {
- return $self->link_to($whole->{key});
+ if ($whole->{key}) {
+ return $self->link_to($whole->{key})
+ }
+ $part = '(complex)';
}
- return $part;
+ use HTML::Tags;
+ return $part =~ /\n/ ? (<pre>, $part, </pre>) : $part;
}
__PACKAGE__->run_if_script;