new to perl and i have a decent little adventure game that is console based which consists of a main.pl and then about 5 perl modules which contain my objects - Room, Character, Weapon, etc (also using Moose).
i'd like to convert it to a html version - where the info displays in html form - a user clicks a new room or action and based off the click maybe a url param is passed and then and new text is displayed. something simple.
i'm much, much more familiar with java and in which case I would just use JSP.
so...i have apache2 and mod_perl. and in doing some research it seems like Template Toolkit might help me achieve this goal as well.
at the moment i have a mod_perl.conf
PerlModule Perl::Lib::Game::Hello
PerlModule CGI
<Location /game>
SetHandler perl-script
PerlHandler Game::Hello
</Location>
which helps me render this simple module.
package Game::Hello;
use Apache2::Const -compile => qw(OK);
sub handler {
my $r = shift;
$r->content_type('text/html');
$r->print("<html><body>Hello World!</body></html>\n");
return Apache2::Const::OK;
}
1;
if i visit localhost/game - this of of course produces 'Hello World!'.
where i am lost is how to fit all the pieces together...i've read about TT and mod_perl and apache2...but I really can't figure out how fit the pieces of the puzzle together.
if someone has a simple example that would help tremendously.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.