CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
mod_perl

 



Paul
Enthusiast

Feb 19, 2002, 9:51 AM

Post #1 of 6 (2453 views)
mod_perl Can't Post

Im writing a script that uses mod_perl and it uses an import() subroutine to load objects on demand eg...

use Objects qw/$IN $DB/;

.....when I turn mod_perl on my CGI parameters are showing blank so I get my custom error asking me to enter a value for the "def" parameter..

Any ideas why it isn't recognising my input using CGI.pm?


(This post was edited by RedRum on Feb 19, 2002, 9:51 AM)


mhx
Enthusiast

Feb 19, 2002, 10:26 AM

Post #2 of 6 (2446 views)
Re: [RedRum] mod_perl [In reply to] Can't Post

Could you explain the problem in a little more detail? I'm not quite getting the point. The only thing that strikes my eye is that variables do of course not interpolate in qw//, but I'm sure you know that already. What exactly do you expect to happen? Is there a configuration where it does work?

-- mhx

At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."

-- Frodo



Paul
Enthusiast

Feb 19, 2002, 12:22 PM

Post #3 of 6 (2440 views)
Re: [mhx] mod_perl [In reply to] Can't Post

Ok, I create the objects in Objects.pm and they are loaded on request into my other modules as shown above so I could do:

use Objects qw/$IN/;

print $IN->header();
print "Hello";

....and it would work fine.

However with mod_perl on, if I try something like:

script.cgi?param=Hello

....and then try to print $IN->param('param'); it is empty.

As soon as I turn mod_perl off and restart apache it works.


mhx
Enthusiast

Feb 19, 2002, 1:02 PM

Post #4 of 6 (2436 views)
Re: [RedRum] mod_perl [In reply to] Can't Post

I'm no web-guy and my personal experience with mod_perl is, well, zero. But I have a feeling it has something to do with mod_perl starting exactly one Perl interpreter at the moment when Apache is started. Perhaps you'll find the following links useful:

http://perl.apache.org/dist/cgi_to_mod_perl.html
http://perl.apache.org/dist/mod_perl_traps.html

I hope someone with more mod_perl experience can help you out.

-- mhx

At last with an effort he spoke, and wondered to hear his own words, as if some other will was using his small voice. "I will take the Ring," he said, "though I do not know the way."

-- Frodo



Paul
Enthusiast

Feb 19, 2002, 1:17 PM

Post #5 of 6 (2434 views)
Re: [mhx] mod_perl [In reply to] Can't Post

Thanks but I've already tried those links :(


(This post was edited by RedRum on Feb 19, 2002, 1:17 PM)


mire
Novice

Mar 1, 2002, 8:22 PM

Post #6 of 6 (2406 views)
Re: [RedRum] mod_perl [In reply to] Can't Post

Your Objects module is using Exporter right ?
You shouldn't use global variables this way. It works but it's not the preffered approach. In Objects module you need to have use vars qw($IN $DB) and appropriate EXPORT tag.

Take a look at the mod_perl guide, it explains exactly this.
Get yourself a fresh CGI.pm.


_______________________________________________

Best regards,

Miroslav Madzarevic, Senior Perl Programmer
perl@modperldev.com
Mod Perl Development  - http://www.modperldev.com
Telephone: +381 64 1193 501
ICQ: 15880893
jamph

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives