When I first started learning and programming Perl, back in 1999, I was doing exactly what you want to do!

If you are using Apache Web Server, please take a look at ePerl, Apache::ePerl and OSSP eperl. I think you will need mod_perl too.

Basically what you want to do is add something like this do your httpd.conf file:

<Files ~ "/usr/local/apache/htdocs/.+\.iphtml$"> Options +ExecCGI SetHandler perl-script PerlHandler Apache::ePerl </Files>

This will make Apache pre-parse the .iphtml files and interprets any embedded Perl scripts. Basically, your .iphtml files are HTML files with Perl script blocks. Note that the extension of the files could be anything you want, even .html but keep in mind this means all .html files would be pre-parsed, even if they don't contain embedded Perl.

So this is what a Perl script blocks would look like:

<html> <body> <? print 'Hello World!<br/>'; !> </body> </html>

Pretty close to PHP, hey? I think you can even change the embedded block delimiters to whatever you want with Apache::ePerl module configuration.

I remember, I even created websites using embedded Perl inside XML files back in the days! I was using AxKit! But it as been decommissioned in 2009.

Good luck!

There are no stupid questions, but there are a lot of inquisitive idiots.

In reply to Re: Embeding Perl in HTML the PHP way by greengaroo
in thread Embeding Perl in HTML the PHP way by heatblazer

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.