|Just another Perl shrine|
Re: Building a webpage with Perlby wfsp (Abbot)
|on Apr 11, 2011 at 11:23 UTC||Need Help??|
...not sure how to make it a webpage.I would recommend having a look at HTML::Template. I like the idea of not having any HTML in my scripts but, as you may guess, in a template. The docs are very good and you should be able to pick it up fairly easily. If you have a reasonable grasp of arrays and hashes, as you indicate, that's a plus. Perhaps two simple examples might best demonstrate the idea.
The first one creates a web page with a message.
the template (my_template_msg.html)
and the output
The second demonstrates displaying a list (something you would be interested in)
The template (my_template_list.html)
and the output (whitespace trimmed for brevity)
The benifits I see of this approach is that your Perl script still looks like a Perl script and your HTML still looks like HTML. Mixing them up, imo, always looks like a mess.
Get these working (holler if you get stuck) and put them somewhere safe. When you're developing something more complex you'll have something to fall back on that works which, for me at least, is an aide to restoring sanity. :-)
HTML::Template doesn't come with perl, you'll have to install it. There are plenty of posts and tutorials on that if you're not familiar with it. Again, shout if you hit a snag.
There are also modules that will help you with the previous/next buttons. I use the, imo, very excellent Data::Page. Perhaps another time.
Best of luck and let us know how you get on.