There's more than one way to do things | |
PerlMonks |
Re: Starting with Perlby radiantmatrix (Parson) |
on Jul 26, 2005 at 13:58 UTC ( [id://478196]=note: print w/replies, xml ) | Need Help?? |
I highly recommend HTML::Template for small projects. It's still a templating system, and gives you the advantages of that, but it's also very light and easy to understand. Templates are nice because you can spend less time debugging HTML inside Perl. With a template, you can design your layout using HTML-editing tools, then replace variable chunks with template variables. If you're familiar with PHP, HTML::Template will not be difficult. Observe a small chunk of an HTML::Template template:
A snippet of Perl to populate the variables in the file (which we'll pretend is named template.html):
As for an equivalent to PHP's include(), read the docs on require. One use of it is like this:
The above would load myfile.pl and process its contents.
<-radiant.matrix->
Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P) The Code that can be seen is not the true Code "In any sufficiently large group of people, most are idiots" - Kaa's Law
In Section
Seekers of Perl Wisdom
|
|