I've used Microsoft's ASP pages, using Perl as the scripting language. So, just put the Perl code inside <% ... %> tags, like you are used to.

Mason, as mentioned on another reply, is similar. But, it is better at allowing you to make reusable modules for a page. I think you will find Mason to be a friendly and gentle transition to make, expecially for porting your old pages. You probably still need to improve existing stuff without re-engineering the whole site, and you've reached the limit on PHP's programming.

But... what's wrong with PHP? Are you bothered by everything being global and in the same namespace? Sure, Perl will be a change. Is the limitation the whole HTML file with embedded fragments? Mason may be a step up in allowing code to execute in more places during the process and affecting what gets done, and in breaking the page up into reusable modules. But it still has limits. I used Mason to make a web page for a store, and was able to design the reusable components (menus, header, footer, etc.) nicely, as it was a static site that just needed to customize the component for each page. I'm also using it on my personal site for a page that automatically picks up all the scans of pages and formats the page to organize and browse them (e.g. this one)

Just printing the HTML you want, under full control of the program, is the ultimate in flexibility. But it gets tedious quickly. There are modules to help with this, in simple ways such as formatting tags as easy as printing text, all the way up to template systems. You will like templates: HTML code for the rough page, but processing is under your control. Your code is on the outside, not the inside.

Finally, there are complete frameworks. Catalyst seems to be the top of the heap now. But you need to learn more than just Perl.


In reply to Re: How to use Perl in web pages? by John M. Dlugosz
in thread How to use Perl in web pages? by kitsune

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.