Hello cbtshare,

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*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.