You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Nikolay Ananiev <ha...@3dzone-bg.com> on 2005/08/15 19:30:56 UTC

Loading Apache2::Request under CGI on Win32

Hello,
I'd like my application to do the following:

if(eval{require Apache2::Request}) {
use_apreq();
} else {
use_cgi_pm();
}

This works with mod_perl on Win32, but has problems under CGI (again on
Win32).

The problem appears when  libapreq2.dll and mod_apreq2.so are not in
$ENV{PATH}.
When eval{require Apache2::Request} is executed, on the desktop appears a
message saying that libapreq2.dll could not be found in the path.
This would hold the perl process until the administrator hits OK.
Is there any way to prevent this message from showing up?
Or maybe there should be a warning while installing apreq2 that in order to
use Apache2::Request under CGI, libapreq2.dll and mod_apreq2.so must be in
the PATH?

I know I can just add the missing paths to the environment, but I'm going to
sell my application and I'd like to prevent the problems that may appear on
my clients' servers.




Re: Loading Apache2::Request under CGI on Win32

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Tue, 16 Aug 2005, Nikolay Ananiev wrote:

> "Randy Kobes" <ra...@theoryx5.uwinnipeg.ca> wrote in message
> news:Pine.LNX.4.63.0508151258450.22690@theoryx5.uwinnipeg.ca...
>> On Mon, 15 Aug 2005, Nikolay Ananiev wrote:
>>
>>> Hello,
>>> I'd like my application to do the following:
>>>
>>> if(eval{require Apache2::Request}) {
>>> use_apreq();
>>> } else {
>>> use_cgi_pm();
>>> }
>>>
>>> This works with mod_perl on Win32, but has problems under CGI (again on
>>> Win32).
>>>
>>> The problem appears when libapreq2.dll and mod_apreq2.so
>>> are not in $ENV{PATH}.
>>> When eval{require Apache2::Request} is executed, on the
>>> desktop appears a message saying that libapreq2.dll could
>>> not be found in the path. This would hold the perl process
>>> until the administrator hits OK. Is there any way to
>>> prevent this message from showing up? Or maybe there
>>> should be a warning while installing apreq2 that in order
>>> to use Apache2::Request under CGI, libapreq2.dll and
>>> mod_apreq2.so must be in the PATH?
>>>
>>> I know I can just add the missing paths to the
>>> environment, but I'm going to sell my application and I'd
>>> like to prevent the problems that may appear on my
>>> clients' servers.
>>
>> I've seen this problem too - what you might try is
>> testing for the presence of APR::Request instead.
>
> This won't help me prevent the problem.

I missed that you were also missing libapreq2.dll in the 
PATH - sorry about that. Testing for APR::Request only needs 
libapreq2.dll (not mod_apreq2.so) in the PATH (and 
potentially also the Apache apr dlls, which typically are in 
the same directory as libapreq2.dll).

> BTW, is there an equivalent of GNU ld's -rpath option for 
> the win32 linker? If there is, it will be easy to fix this 
> problem.

I'm not aware of one.

-- 
best regards,
randy

Re: Loading Apache2::Request under CGI on Win32

Posted by Nikolay Ananiev <ha...@3dzone-bg.com>.
"Randy Kobes" <ra...@theoryx5.uwinnipeg.ca> wrote in message
news:Pine.LNX.4.63.0508151258450.22690@theoryx5.uwinnipeg.ca...
> On Mon, 15 Aug 2005, Nikolay Ananiev wrote:
>
> > Hello,
> > I'd like my application to do the following:
> >
> > if(eval{require Apache2::Request}) {
> > use_apreq();
> > } else {
> > use_cgi_pm();
> > }
> >
> > This works with mod_perl on Win32, but has problems under CGI (again on
> > Win32).
> >
> > The problem appears when libapreq2.dll and mod_apreq2.so
> > are not in $ENV{PATH}.
> > When eval{require Apache2::Request} is executed, on the
> > desktop appears a message saying that libapreq2.dll could
> > not be found in the path. This would hold the perl process
> > until the administrator hits OK. Is there any way to
> > prevent this message from showing up? Or maybe there
> > should be a warning while installing apreq2 that in order
> > to use Apache2::Request under CGI, libapreq2.dll and
> > mod_apreq2.so must be in the PATH?
> >
> > I know I can just add the missing paths to the
> > environment, but I'm going to sell my application and I'd
> > like to prevent the problems that may appear on my
> > clients' servers.
>
> I've seen this problem too - what you might try is
> testing for the presence of APR::Request instead.

This won't help me prevent the problem.
BTW, is there an equivalent of GNU ld's -rpath option for the win32 linker?
If there is, it will be easy to fix this problem.




Re: Loading Apache2::Request under CGI on Win32

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 15 Aug 2005, Nikolay Ananiev wrote:

> Hello,
> I'd like my application to do the following:
>
> if(eval{require Apache2::Request}) {
> use_apreq();
> } else {
> use_cgi_pm();
> }
>
> This works with mod_perl on Win32, but has problems under CGI (again on
> Win32).
>
> The problem appears when libapreq2.dll and mod_apreq2.so 
> are not in $ENV{PATH}.
> When eval{require Apache2::Request} is executed, on the 
> desktop appears a message saying that libapreq2.dll could 
> not be found in the path. This would hold the perl process 
> until the administrator hits OK. Is there any way to 
> prevent this message from showing up? Or maybe there 
> should be a warning while installing apreq2 that in order 
> to use Apache2::Request under CGI, libapreq2.dll and 
> mod_apreq2.so must be in the PATH?
>
> I know I can just add the missing paths to the 
> environment, but I'm going to sell my application and I'd 
> like to prevent the problems that may appear on my 
> clients' servers.

I've seen this problem too - what you might try is
testing for the presence of APR::Request instead.

-- 
best regards,
randy kobes

Re: Loading Apache2::Request under CGI on Win32

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 15 Aug 2005, Nikolay Ananiev wrote:

[ ... ]
> The problem appears when  libapreq2.dll and mod_apreq2.so are not in
> $ENV{PATH}.
> When eval{require Apache2::Request} is executed, on the desktop appears a
> message saying that libapreq2.dll could not be found in the path.
> This would hold the perl process until the administrator hits OK.
> Is there any way to prevent this message from showing up?
> Or maybe there should be a warning while installing apreq2 
> that in order to use Apache2::Request under CGI, 
> libapreq2.dll and mod_apreq2.so must be in the PATH?

For the libapreq2 ppm package in our repository:
   http://theoryx5.uwinnipeg.ca/ppms/
I've added a message along these lines to the post-install 
script that fetches and installs libapreq2.dll and 
mod_apreq2.so (technically, in order to use these under 
Apache, you don't need to put either in the PATH, as they
can be included via directives in httpd.conf).

> I know I can just add the missing paths to the 
> environment, but I'm going to sell my application and I'd 
> like to prevent the problems that may appear on my 
> clients' servers.

If you have control over where the users install libapreq2, 
you could have libapreq2.dll installed into some location in 
the system PATH (eg, $ENV{SystemRoot}), and then try 
APR::Request (which doesn't require mod_apreq2.so). 
Permissions and/or system policy may prevent this option,
however.

If you have control over the installation of mod_perl,
you might consider editing Apache2::BuildConfig to
reflect the location of the installed Apache2 binary
(I thought about doing this for the mod_perl ppm
package in our repository, but decided not to, in
case something went wrong). What might be safer is to
use something like the code in install_libapreq2 in
    http://theoryx5.uwinnipeg.ca/ppms/scripts/
to guess at the location of the installed Apache2; I
think this handles most of the common installation
locations.

Alternatively, if you know the installation of Apache 
involves adding any Registry settings, you could get
at that information there.

Another approach is just to look for a *file*, for example, 
Apache2/Request.pm, in @INC, and if it's there, assume 
Apache2::Request is available. This of course has the 
disadvantage that it doesn't check if it's a working 
installation.

-- 
best regards,
randy