You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Alexander Knack <ak...@dasburo.de> on 2000/03/09 21:11:19 UTC

[modperl]

Apache/Mod_Perl

hi,
just one thing i want to mention.

in a cgi script i do:
use CGI;
my $result = `./foo.pl a=b c=d`;

foo. pl looks like this:
use CGI;
my $q = new CGI (join '&', @ARGV);
print $q->param('a');

what happens is, that foo.pl won't execute because of:
error.log:
Can't locate object method "request" via package "Apache"


it works when i put the line
$CGI::MOD_PERL = 0;
into foo.pl



my httpd.conf:
<Files *.pl>
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options ExecCGI
</Files>
-- 
+--------------------------------------------------------------------+
| Alexander Knack  ........Entropie erfordert keine Wartung .........|
|  dasburo.de      ..................................................| 
+--------------------------------------------------------------------+

Re: [modperl]

Posted by Doug MacEachern <do...@pobox.com>.
On Thu, 9 Mar 2000, Cliff Rayman wrote:

> yes - you are calling foo.pl via a separate
> process which of course is outside of mod_perl.
> 
> it is inheriting the environment however, so
> it thinks it is running under mod_perl.

$ENV{MOD_PERL} is not inherited, if CGI.pm would check that instead of
$ENV{GATEWAY_INTERFACE}, that should fix the problem.
did anyone mention ``  throws performance out the window?


Re: [modperl]

Posted by Cliff Rayman <cl...@genwax.com>.
yes - you are calling foo.pl via a separate
process which of course is outside of mod_perl.

it is inheriting the environment however, so
it thinks it is running under mod_perl.

your fix is correct - but you probably do not
want to run a perl script using the backticks.

cliff rayman
genwax.com

Alexander Knack wrote:

> Apache/Mod_Perl
>
> hi,
> just one thing i want to mention.
>
> in a cgi script i do:
> use CGI;
> my $result = `./foo.pl a=b c=d`;
>
> foo. pl looks like this:
> use CGI;
> my $q = new CGI (join '&', @ARGV);
> print $q->param('a');
>
> what happens is, that foo.pl won't execute because of:
> error.log:
> Can't locate object method "request" via package "Apache"
>
> it works when i put the line
> $CGI::MOD_PERL = 0;
> into foo.pl
>
> my httpd.conf:
> <Files *.pl>
>  SetHandler perl-script
>  PerlHandler Apache::Registry
>  Options ExecCGI
> </Files>
> --
> +--------------------------------------------------------------------+
> | Alexander Knack  ........Entropie erfordert keine Wartung .........|
> |  dasburo.de      ..................................................|
> +--------------------------------------------------------------------+