Cannot Embed Perl Scripts In WordPress

I spent all day yesterday without any success trying to embed a Perl Script in my WordPress blog. The reason why I need to embed a Perl script is that I have scripts that will dynamically generate content. The script can be activated by a static HTML page.  As an example of illustration, please visit the following page:

As can be seen from the above static index.html page, the page can fetch different ‘hot sexy women pictures’ and ‘love quote of the moment’. Theses are done by two Perl Scripts embedded in the page.

For ‘hot sexy women pictures’, they are dynamically fetched by this Perl script, randomimage.cgi embedded in the page, and called with HTML image tags <IMG SRC=” “>:

<IMG SRC=”../cgi-bin/hc/randomimage.cgi” ALT=”” width=”400″>

randomimage.cgi when activated, will randomly select a woman picture file like woman.jpg, woman2.jpg, etc stored in a directory and outputs the file.

For ‘love quote of the moment’, they are dynamically fetched by this Perl script, timequote.cgi embedded in the page like the following:

<!–#exec cgi=”../cgi-bin/hc/timequote.cgi” –>

timequote.cgi will randomly select a love quote and output it.

I tried numerous times to embed the above two scripts in my blog, however, I could not get them working. My blog simply will not activate any perl scripts. I searched the net for answers, but found nothing. It was frustrating!

Finally, at the end of a long exhausting day, by accident I came across this WordPress Plugin ‘Include Me’. The Pugin will fetch the content of any file I specified in my blog’s root directory and put it in the webpage. I added the Plugin, activated it, played it with different test files to ensure I know how to use the Plugin properly. I finally got the hang of it.

To get a picture, I can put a picture file name, picture1.jpg, picture2.jpg etc in a text file and have ‘Include Me’ fetch the text file, output it in my blog. The text file will simply have HTML image tags <IMG SRC=” “> like the following:

<IMG SRC=”” ALT=”” width=”400″>

However, I cannot replace the picture file name, picture1.jpg with a Perl or cgi script name that has a format ending in cgi or pl. It appears that WordPress will not activate any Perl scripts as in a static HTML page. I was back to square one.

An idea suddenly dawned me. Why not design a Perl script to update the content of the file instead of putting the script in the file. For example, to get random pictures from a directory, have a Perl Script randomly fetch a picture file name from the directory, picture1.jpg, picture2.jpg, etc, then update the text file accordingly. The picture in the file will then be reflected in the blog. Use the site server’s timer, cron job to activate the Perl Script.

The following flower pictures are the results of the idea. The Perl Script is activated every 5 minutes to update the text file. Therefore, the flower pictures in this webpage will change every 5 minutes. Let me know if you see different results.