You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ra...@active.co.il on 2000/07/26 00:33:09 UTC

On the fly "do" (require)‎

Hope I asking this question on the right place.
‎I got some problem migrating me CGI to mod_perl.‎
‎I'm "require" parameter file on the fly using the user input‎
‎to decided which file to load.‎

‎Let say I got tree files:‎
‎main.cgi, param1.pl, param2.pl‎

‎The main.cgi load configuration parameters from one of the‎
‎param's file and then print the parameters to the browser.‎

‎----- main.cgi ------------‎
‎#!/usr/local/bin/perl -w‎
‎use strict;‎
‎my ($forum,$back_url);‎
‎use CGI;‎
‎$q = new CGI;‎
‎$forum = $q->param('forum');‎
‎do "c:/home2/rami/www/forums/setups/".$forum.".setup"  ||‎
‎ print("Can't require<br>\n");‎

‎print SOME HTML STUFF ...‎
‎print "<h1>the forum is: $forum<br>\n";‎
‎print "back_url $back_url<br>\n";‎
‎print SOME HTML STUFF ...‎

‎------ param2.pl ---------‎
‎.‎
‎.‎
‎.‎
‎$back_url = "123";‎
‎.‎
‎.‎
‎.‎
‎------ param3.pl ---------‎
‎.‎
‎.‎
‎.‎
‎$back_url = "456";‎
‎.‎
‎.‎
‎-----------------------------------‎
‎The phenomenon is that on every $forum number I load‎
‎$back_url (or any other variable) is allways null.‎

‎Is there a way to use my old CGI come with our massive rewrite?‎

‎Regards,‎
‎Rami Addady‎
‎rami@tase.co.il‎



Re: On the fly "do" (require)

Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi there,

On Wed, 26 Jul 2000 rami@active.co.il wrote:

> I got some problem migrating me CGI to mod_perl.

I do not know if I understand your question, but you could
try looking at Apache::Registry to get your CGI scripts to
work under mod_perl.

Also look at

http://perl.apache.org/guide

73,
Ged.