Automatically prepend executable Perl scripts using .htaccess (like php_value auto_prepend_file)?

I have previously built sites using PHP, where I automatically included header and footer html using the following lines in .htaccess on an Apache host:

php_value auto_prepend_file "/var/www/html/parts/header.htm"
php_value auto_append_file  "/var/www/html/parts/footer.htm"

In these files I could put executable PHP code.

My current project is written in Perl, not in PHP.

Is there any way to automatically prepend and append executable Perl files using .htaccess?

Answer

It depends on how exactly you’re using perl. There are several different frameworks that would do what you want – e.g. HTML::Mason has the autohandler that will load stuff for you. There’s also a perl module called Apache Sandwich that might be what you’re looking for.

Attribution
Source : Link , Question Author : Andrew Swift , Answer Author : Jenny D

Leave a Comment