Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to console adventure game to html mod_perl version by cmikel

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-23 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found