Forum Moderators: coopster & phranque

Message Too Old, No Replies

Converting CGI to mod_perl

         

martin

1:11 pm on Aug 4, 2003 (gmt 0)

10+ Year Member



Hi I have some Perl code that runs fine as CGI and I want to get it converted to mod_perl. After doing some research I found that there're actually 2 modes in which one could run his code using the Apache::Registry and Apache::PerlRun modules. The mod_perl site says that with Apache::Registry one can only run scripts which are use strict and use warnings and everything else with PerlRun.

I set up mod_perl with Apache::PerlRun but it turned out it doesn't quite run every working CGI scripts, there're config variables in external files that were $variables which were out of scope, after I changed them to $namespace::variables they were once again in scope.

The problems I have right now are:

1) I have some external libraries which are not in a package by themselves and were used w/o ISA/Exports, I think that I can convert most of them with a simple grep "^sub"... but I was wondering if there's any chance I can save this convert

2) There are some functions that instead of returning a result modify global variables and even some which generate new ones based on a parameter like $$var or %$var

I already read the porting guide at the mod_perl site which should actually be renamed to How to REWRITE your CGI scripts to mod_perl, if anybody can point me to information on How to convert the scripts with the least changes possible or if there's another module other than Apache::Registry/Apache::PerlRun which can really run all CGI scripts.

Storyteller

9:12 am on Aug 5, 2003 (gmt 0)

10+ Year Member



I don't have a ready answer fot you, but what I would do is look at alternative "CGI accelerators" like SpeedyCGI.

martin

10:36 am on Aug 5, 2003 (gmt 0)

10+ Year Member



Thanks Storryteller, I tried SpeedyCGI but it looks like I'll need a rewrite too with that, it doesn't give me an Internal Server Error on every other request like mod_perl does at least. I also tried FastCGI but it behaves really strange.