go learning some modern Perl way to do it! go for a Mojolicious or Dancer2 solution. Here I propose you a draft, just a draft, of a Dancer2 solution using TemplateToolkit too; both are worth to know.
You can get a barebone working application running dancer2 -a MyWeb::App (see the project page)
Then you modify config.yaml to use TemplateToolkit (see my example here this was a school project i've done: you can play with it and see other solutions).
Then under /lib you have the perl module where you'll declare your routes: in a very plain simple way I'd procede having a route for the main page, it's associated template to show. Like in:
# draft of the module code package YourNameApp; use Dancer2; # this is the root and will show the index.tt get '/' => sub { template 'index' => { 'title' => 'index: choose an action' }; };
The above will shows index.tt where the string index: choose an action will be used as the content of the template's variable with name title for example, in index.tt you can have a div showing the title:
<div id="headline"> <% title %> </div> # put here the rest of your HTML, probably a list of link pointing to +other routes, like: # 1) Insert all Apps belonging to a group # pointing to /ins_all_apps
Then you add such route to your module:
... get '/ins_all_apps' => sub { # call your own sub that you can put in this same file my @results = get_reults_of_ins_all_apps; # render the appropriate template template 'results' => { 'descr' => $resutls[0], 'full_text' => $resutls[1] }; };
Go on.. and have fun!
L*
In reply to Re: Perl Script to run in web browser -- Dancer2 draft
by Discipulus
in thread Perl Script to run in web browser
by cbtshare
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |