Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

console adventure game to html mod_perl version

by cmikel (Novice)
on May 13, 2013 at 23:24 UTC ( #1033377=perlquestion: print w/ replies, xml ) Need Help??
cmikel has asked for the wisdom of the Perl Monks concerning the following question:

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.

Comment on console adventure game to html mod_perl version
Select or Download Code
Re: console adventure game to html mod_perl version
by Anonymous Monk on May 14, 2013 at 04:57 UTC
Re: console adventure game to html mod_perl version
by Pizentios (Scribe) on May 14, 2013 at 13:20 UTC
    I would check out a framework like the above Anonymous Monk pointed out. Personally i have had great success with mojolicious. Once you learn the basics of a mojolicious lite app, it shouldn't be to hard to integrate your code into the lite app and have a full featured web based adventure game.
    -Pizentios

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1033377]
Approved by ww
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2014-10-24 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls