Hey,
I splited into three part:
1, the first is the route handler, AJAX backend, ...
get '/' => sub {
template 'rootTemplate', {
}
};
ajax '/getAll' => sub {
my $allHashRef = HelperModule->fetchAll_hashref();
foreach ( keys %$trac) {
push @_, {
value => "$_",
text => "$trac->{$_}",
}
}
return to_json(\@_);
return to_json(\@_);
};
2, data visualization: template toolkit, bootstrap, jquery, ...
3, data gathering in separated Perl module
In the separated Perl modul I do all of the queries, updates, creation and returning the object, hashes, arrays, ... to the caller.
In this way I can do more efficient testing and a code reusing for example in a Perl script.