Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Embeding Perl in HTML the PHP way

by greengaroo (Hermit)
on Sep 13, 2012 at 13:36 UTC ( #993492=note: print w/ replies, xml ) Need Help??


in reply to Embeding Perl in HTML the PHP way

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.


Comment on Re: Embeding Perl in HTML the PHP way
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993492]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-09-30 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (385 votes), past polls