in reply to Apache::Registry with CPanel

If I understand your question correctly, you want to know if you need to include ...

use Apache::Registry;

... in your scripts. The answer is no.

Apache::Registry is a special type of module known as a mod_perl handler. To oversimplify things a bit, it reverses the normal relationship and 'uses' your script :-)

The configuration snippet you quoted is a way of telling Apache that any URL that starts /perl/ should be handled by Apache::Registry which in turn will look in /perl/apache/scripts/ for a specific script to handle each request. This is an alternative to using Apache's 'ScriptAlias' directive to have requests that start /cgi-bin/ handled by mod_cgi.

Setting up a handler this way affects all scripts in the directory.

Update: I forgot to mention that your coding needs to be a bit more careful under Apache::Registry than under CGI. Make certain your script runs with 'use strict;' and make sure that any global variables are declared with 'our' rather than 'my'. You'll also want to check the error log for warnings.

Replies are listed 'Best First'.
Re: Re: Apache::Registry
by CountZero (Bishop) on Dec 18, 2002 at 10:58 UTC

    On a more general level, all your PERL-scripts which run under mod_perl must be coded carefully, as they probably get only compiled once for a multitude of requests and therefore the old contents of variables my linger on long after they should have died under a non mod_perl run script.

    The use of strict is not only recommended it is almost indispensable to guard against careless programming style.
    That and make sure that you initialize all your variables (either explicitly or trough the use of my) as you cannot count on them being 'virgin'.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Re: Apache::Registry
by Andy (Novice) on Dec 18, 2002 at 07:46 UTC
    I dont really want it to affect all scripts on the server. So if the first line of the httpconfig bit is only my directory it will be ok?

      It won't affect all scripts on your server, but it will affect all scripts in /perl. The reason is that your <Location> directive associates Apache::Registry with /perl.

      Yes.

      rdfield