You might try it without the parens:

use Apache2::compat;


Petry Roman, IT wrote:
Hello @all,

we are just transfering our Intranet Server which used Apache 1.3 and mod_perl1 
from SLES8 to SLES10 wiht Apache2 and mod_perl2.

The switch has to go quick and we can´t redesign all of our old mp1 programs to mp2, so we try to use the compat module. But I have no luck with it. I tested my config with SELS10, Opensuse 10.3 and Ubuntu but i hit everytime the same problem.
I searched the Mail Archvie and the Documentation, but no luck.

I have the following test script.Very simple.

test1.pl
#!/usr/bin/perl
my $r = Apache->request();
$r->send_http_header('text/plain');
$r->print("mod_perl rules!\n");

apache2 config looks like this.
ScriptAlias /perl/ /usr/lib/cgi-bin/
    <Location /perl/>
        # mod_perl mode
        SetHandler perl-script
        PerlResponseHandler ModPerl::Registry
        PerlOptions +ParseHeaders
        Options +ExecCGI
    </Location>

and

[EMAIL PROTECTED]:/etc/apache2/conf.d# cat perl.conf
PerlRequire "/etc/apache2/mod_perl-startup.pl"

and mod_perl-startup.pl looks like this

[EMAIL PROTECTED]:/etc/apache2# cat mod_perl-startup.pl
# This file is a placeholder; you can safely ignore or delete it.
print "startup perl dh";
use lib '/usr/lib/perl5/';

  # enable if the mod_perl 1.0 compatibility is needed
  use Apache2::compat ();


I get the following output..

Software error:
Can't locate object method "request" via package "Apache" at 
/usr/lib/cgi-bin/test1.pl line 4.
For help, please send mail to the webmaster ([EMAIL PROTECTED]), giving this error message and the time and date of the error.
It seems, he can´t find the requested methods.. How can i validate that the 
compat module is loaded and working ?


if i print the @env array with this perl script i get.
#!/usr/bin/perl -w
use strict;
use CGI::Carp qw(fatalsToBrowser);

print "Content-type: text/html\n\n";
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', "\n";
print "<html><head><title>env array</title></head><body>\n";
print "<h1>Umgebungsvariablen:</h1>\n";
print "<table border=\"1\">\n";
print "<tr><th align=\"left\" bgcolor=\"#E0E0E0\">varname</th>",
      "<th align=\"left\" bgcolor=\"#E0E0E0\">value</th></tr>\n";
foreach(keys(%ENV)) {
  print "<tr><td><b>$_</b></td><td><tt>$ENV{$_}</tt></td></tr>\n";
}
print "<tr><th align=\"left\" bgcolor=\"#E0E0E0\" colspan=\"2\">sum: ",
      scalar keys(%ENV)," envarray</th></tr>\n";
print "</table>\n";
print "</body></html>\n";

here the output...

MOD_PERL_API_VERSION    2
PATH    /usr/local/bin:/usr/bin:/bin
REQUEST_URI     /perl/env.pl
GATEWAY_INTERFACE       CGI/1.1
SERVER_ADDR     172.31.127.193
DOCUMENT_ROOT   /var/www/html
HTTP_HOST       172.31.127.193
MOD_PERL        mod_perl/2.0.2

so i think mod_perl2 is enabled.

Any help would be great.
bye
Roman


--
Jim Brandt
Administrative Computing Services
University at Buffalo

Reply via email to