Re: An URL is not Invoking the Anticipated Perl Module [mp2]

2003-01-10 Thread Stas Bekman
Steve, please don't throw more than one question into the same email. It 
makes it really hard to followup. Please post each question separately.

Steve D wrote:

For the purpose of clarifying the issue, are you saying there is contention
between the two handlers which are declared within the httpd.conf, as it has
been setup in this case?  That is, since a handler has been declared within
by the directory section [/var/www/perl] and another for the location
[/CurrDate], the two handlers are contenting against the one other?
Therefore, in this case, although  has been defined, the
default handler  is overriding the CurrDate name
space[!?]  Would someone please clarify.


Eh? Did you: s/per-script/perl-script/ and tried again?


From studying this further, I noticed I forgot to prefix the 
/CurrDate> section with a PerlModule directive.  Consequently, the following
line has been added to the perl.conf file.

PerModule:  MyApache::CurrDate

However, now, with this addition, when starting the Apache the following
exception is genereated:


httpd failed. The error was: Starting httpd: [Fri Jan 10 12:11:15 2003]
[error] Can't locate MyApache/CurrDate.pm in @INC (@INC contains:
/var/www/perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at (eval 4)
line 3.


You'll notice from this message, the path does include '/var/www/perl' and
the perl module which is being called is within the
'/var/www/perl/MyApache/' directory.  (For good measure it was also placed
within '/var/www/perl' without a resolution to the run time exception.)


There was a bug in older mod_perl versions, and you'd get the "Can't 
locate module" error when in fact, the module has failed to compile. 
Please try again with the cvs version.

Incidentally, the format of the configuration file which is being used in
this case has been adapted from the article "Introducting mod_perl
Handlers".  I've also been using "Getting Your Feet Wet with mod_perl".
These resources can be respectfully found at
http://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_
and
http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules I
found these to be very helpful for a newcomer.


Great.


This later article was especially beneficial for it connected several
fregmented thoughts together [at least in my own learning curve] into good
concise working document.  In my case, I found it helpful to get a perl
script working [as a first measure] and then proceed to the use of a
response handler.  However, I did run across a problem with how the perl
script name space was defined.  The first example [in the article "Getting
Your Feet Wet"] would not work when I used the syntax "PerlResponseHandler
Modperl::Registry" nor "PerlResponseHandler Modperl::Registry::handler".
Consequently, I changed the format to "PerlHandler
ModPerl::Registry::handler" and then my test script was able to run.


It should work with 'PerlResponseHandler Modperl::Registry'. What was 
the error message (please start a new thread on this one, don't continue 
here)

Consequently, at this stage, a few questions remain.  1) Since, at least in
this situation, I had to adapt the handler from being PerlResponseHandler to
PerlHandler in order to get the perl scripting to work, does that also mean
the same adaptation will be necessary in order to yield a result from a
reponse handler for the CurrDate.pm module?

2) Once again, how do I instruct Apache to properly locate the CurrDate.pm
file?  [Stas, you may have already given me the answer to this latter
question but more clarity is still needed.]

3) When I include the provision of the line "PerModule:  MyApache::CurrDate"
within the perl.conf file, Apache throws an exception and failed to start.


s/PerModule:/PerlModule/

I don't know where did you take PerModule: from.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: An URL is not Invoking the Anticipated Perl Module [mp2]

2003-01-10 Thread Steve D

To: Stas Bekman [or anyone else];

For the purpose of clarifying the issue, are you saying there is contention
between the two handlers which are declared within the httpd.conf, as it has
been setup in this case?  That is, since a handler has been declared within
by the directory section [/var/www/perl] and another for the location
[/CurrDate], the two handlers are contenting against the one other?
Therefore, in this case, although  has been defined, the
default handler  is overriding the CurrDate name
space[!?]  Would someone please clarify.

>From studying this further, I noticed I forgot to prefix the  section with a PerlModule directive.  Consequently, the following
line has been added to the perl.conf file.

PerModule:  MyApache::CurrDate

However, now, with this addition, when starting the Apache the following
exception is genereated:


httpd failed. The error was: Starting httpd: [Fri Jan 10 12:11:15 2003]
[error] Can't locate MyApache/CurrDate.pm in @INC (@INC contains:
/var/www/perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/Apache2
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at (eval 4)
line 3.


You'll notice from this message, the path does include '/var/www/perl' and
the perl module which is being called is within the
'/var/www/perl/MyApache/' directory.  (For good measure it was also placed
within '/var/www/perl' without a resolution to the run time exception.)
Incidentally, the format of the configuration file which is being used in
this case has been adapted from the article "Introducting mod_perl
Handlers".  I've also been using "Getting Your Feet Wet with mod_perl".
These resources can be respectfully found at
http://perl.apache.org/docs/2.0/user/handlers/intro.html#What_are_Handlers_
and
http://perl.apache.org/docs/2.0/user/intro/start_fast.html#Handler_Modules I
found these to be very helpful for a newcomer.

This later article was especially beneficial for it connected several
fregmented thoughts together [at least in my own learning curve] into good
concise working document.  In my case, I found it helpful to get a perl
script working [as a first measure] and then proceed to the use of a
response handler.  However, I did run across a problem with how the perl
script name space was defined.  The first example [in the article "Getting
Your Feet Wet"] would not work when I used the syntax "PerlResponseHandler
Modperl::Registry" nor "PerlResponseHandler Modperl::Registry::handler".
Consequently, I changed the format to "PerlHandler
ModPerl::Registry::handler" and then my test script was able to run.

Consequently, at this stage, a few questions remain.  1) Since, at least in
this situation, I had to adapt the handler from being PerlResponseHandler to
PerlHandler in order to get the perl scripting to work, does that also mean
the same adaptation will be necessary in order to yield a result from a
reponse handler for the CurrDate.pm module?

2) Once again, how do I instruct Apache to properly locate the CurrDate.pm
file?  [Stas, you may have already given me the answer to this latter
question but more clarity is still needed.]

3) When I include the provision of the line "PerModule:  MyApache::CurrDate"
within the perl.conf file, Apache throws an exception and failed to start.
Does this line need to be included, or something similiar to it, in order to
Apache to locate the perl module?  [Remember again, in this situation, a
startup.pl script has been delcared in order to provide a library to search
for perl modules.]  The reason I'm asking this question is because the
"Introducing mod_perl Handlers" article uses this convention while the
"Getting Your Feet Wet with mod_perl" omitts this line.

The environment is RH 8.0, Apache 2.0.40, mod_perl 1.99_05-dev, and Perl
5.8.0.  [For those who are interested, the original post includes a complete
copy of perf.conf and CurrDate.pm.]

I have been piecing together various web resources but remain uncertain how
to procede.  Further help is appreciated.  Stas, you have already replied to
this once, and to another setup problem for which I was having.  I am
grateful.  Thank you.

Steve D wrote:

> The problem: Apache is generating "File does not exist" within its
> error.log and the message "Object not found" (The requested URL was not
> found. Error number 404.) while attempting to call a perl module from a
> brower.
[...]
> 
> SetHandler per-script
> PerlResponseHandler MyApache::CurrDate
> 
s/per-script/perl-script/

SetHandler can't verify at parsing time whether a handler really exists,
it's really a string. So in your case the default handler was handling
that Location.

See: http://httpd.apache.org/docs-2.0/mod/core.html#sethandler

If you still have questions regarding this (my gue