Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

for mod-perl gurus

by ralphie (Friar)
on Nov 20, 2001 at 01:18 UTC ( [id://126389]=perlquestion: print w/replies, xml ) Need Help??

ralphie has asked for the wisdom of the Perl Monks concerning the following question:

howdy -

i've spent some time over the last couple of work days resolving this issue, and it's my hope that fellow monks can help expand my awareness of apache and mod-perl with their responses, although some of this may be distribution-specific (debian woody).

i have an in-house apache server i'm developing for use as a query server, and have just started migrating some working scripts from cgi to mod-perl. the query strategy followed in this specific instance is fairly generic - a frame is displayed in which a user defines parameters that return a set of parent records, from which the user selects a subset for a more detailed summary. as i first started testing under mod-perl, the intermediate stage started returning an erroneous result set, despite the fact that i could execute the sql statement in dbish and retrieve appropriate results.

i won't bore you with the diagnostic steps i took, suffice it to say that it took me a while to spot the apache-perl package in debian (doh). the faulty environment had involved the base apache and libapache-mod-perl packages.

my questions are two and a half-fold

1- why did this work at all, given that i had httpd.conf configured to use mod-perl, but the installed httpd had no perl interpreter? and since it did partially work, why did it fail only in one result set ... i was able to retrieve summaries from the child tables on the selected records, though they weren't the ones i really wanted.

2- during the process, i tried to back away from mod-perl, using debian's apt-get to remove everything and reinstall apache, replacing httpd.conf with the one from the previous working cgi environment. this was not effective - the bad result set continued to be returned in an environment that should have been the same as i had when i started. anyone have any idea why?

i remain, of course, eternally grateful for whatever shards of enlightenment are passed my way.

ralphie

Replies are listed 'Best First'.
Re: for mod-perl gurus
by perrin (Chancellor) on Nov 20, 2001 at 01:52 UTC
    It's difficult to figure out what to tell you based on this problem description, but it sounds like you were running your scripts under CGI rather than mod_perl, and maybe still are. Did you add anything to your httpd.conf about using Apache::Registry? Can you post the snippet of your conf file that deals with mod_perl?

    The problem with the bad query results sounds like a bug in your perl code, and you should follow normal debugging procedures to figure out what's wrong. If you really are running under mod_perl, this may be an issue with global variables being saved between invocations of the script.

      actually, i can determine the validity of the result sets in pretty straightforward fashion, and i'm getting the right stuff ...

      chunks of httpd.conf

      <Directory /home/username/mod-perl/> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> <IfModule mod_perl.c> Alias /mod-perl /home/username/mod-perl <Location /mod-perl> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI </Location> </IfModule> Alias /perl/ /home/username/mod-perl/
        Okay, it looks like if you request a URL in /mod-perl you will be running correctly uder Registry. You can test this by printing out the special $ENV{MOD_PERL} variable in your script. Before you installed this, I assume you were running under CGI, which yuo configured with the ExecCGI option.

        If you're getting the right data back in your script, but it isn't going to the screen, you may be using globals incorrectly (they don't get cleared out between requests under Apache::Registry). If you're using modules and changing them without restarting the server, your changes may not be getting picked up. But I thought you said you were NOT getting the right stuff?

Re: for mod-perl gurus
by ralphie (Friar) on Nov 20, 2001 at 04:06 UTC
    sorry if i didn't make that clear ... under cgi i was getting the right stuff, then i made my initial partial mod-perl install and started getting a bad result set even though i could get the right one by running the dbi shell. my installation is ok now, and i'm getting the right data. i'm just trying to figure out what was going on when i had the partial install, but at a partial level i was getting data back. what interpeter was getting executed, if the interpreter was getting executed and returning a good data set in one context, why didn't it in another, and why did i continue to get a bad result after i backed away from mod-perl ... these are the kinds of questions i'm asking.

    i recognize that it's difficult to answer these without being able to look at the system, and i'm not expecting a definitive answer, just an experienced suggestion of things to look at.

Re: for mod-perl gurus - probable resolution
by ralphie (Friar) on Nov 21, 2001 at 20:53 UTC
    i just realized that w/o mod-perl i would have been executing the interpreter in the shebang (duh). i'm still not sure what dbi libraries were being called to give me a funky result set, but at least the fog is lifting a little.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://126389]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-24 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found