The simplest of all ways is to use the CGI module and just print out your HTML:
#!/usr/bin/perl -w use strict; use CGI; my $q = CGI->new; my $name = $q->param('name'); print $q->header(); # just ignore the man behind the curtain print '<html><title>First page</title><body>'; if (defined $name) { print "<h1>Hello $name</h1>"; } else { print "<h1>Please enter your name</h1><form action=''><input name= +"name" type="text"></form>"; }; print '</html>';
In short time though, you will want to move to one of the templating systems. If you feel at home with the code-intermingled-with-HTML way of PHP, then Mason might be your thing. If you want to get away as far as possible from that, take a look at Petal, HTML::Seamstress and HTML::Template. The Template Toolkit has its own powerful programming language built in, so you can get more creative with these templates, but, again, beware of the danger of mixing code and HTML too much.
In reply to Re: How to use Perl in web pages?
by Corion
in thread How to use Perl in web pages?
by kitsune
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |