|
|
| Perl Monk, Perl Meditation | |
| PerlMonks |
Re: Embeding Perl in HTML the PHP wayby aaron_baugher (Chaplain) |
| on Sep 11, 2012 at 22:33 UTC ( #993077=note: print w/ replies, xml ) | Need Help?? |
|
Your example is how it's done in HTML::Mason, although the syntax would be slightly different. For one thing, you don't need the printf at all, since you're just printing a string. So you can do any of these:
Like others here, I prefer frameworks these days. Mixing code with layout just doesn't scale well at all. Mason is better than PHP because it's Perl, but things still get ugly easily for some of the same reasons they do in PHP. Currently I'm using Dancer with Dancer::Template::Mason as my templating system, and liking that quite a bit. My templates are Mason, so they can use Perl code for things like loops, rather than requiring me to learn some new templating system's loop syntax. But since all my actual code that processes the data (Controller and Model, in MVC terms) is separate, the template files are still very clean. Aaron B.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||