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!
|
---|