You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Matt Corbett <mc...@boltblue.com> on 2003/07/02 17:50:51 UTC
Please help newbie with Module problem.
Dear List,
I have got a problem that I can't fix no way, no how.
I am porting a Linux website to xp pro.
I need to use the Apache::Request module on a range of programs to use
POST and GET methods in my HTML to process information gathered.
The port I am using is the Activestate Apache/1.3.27 (Win32)
mod_ssl/2.8.14 OpenSSL/0.9.7b mod_perl/1.27_01-dev
I have installed 'Apache::Request with perl -MCPAN -e "shell"' and
'install Apache::Request' . and if I try to run the install I get a
message saying 'Apache::Request is up to date'
I dont seem to be able to test the module becuase I cannot make it with
NMAKE.EXE, is this necessary. I use nmake15.exe should I be using a
later one.
The @INC is c:\perl\lib and c:\perl\site\lib
The request.pm is in /perl/site/lib/apache
however when I run the following code
#!c:/perl/bin/perl -w
use Apache ();
use Apache::Request ();
use CGI::Carp qw(fatalsToBrowser);
my $r = Apache::Request->new(shift);
# my $apr = Apache::Request->new($r);
print "Content-type:text/html\n\n";
print "Hello, World...\n";
print $r;
print @INC;
I receive the message
Can't locate object method "new" via package "Apache::Request" (perhaps
you forgot to load "Apache::Request"?) at c:\apache\cgi-bin\ap2.pl line
6.
This prob has been with me a weeka nd I just don't seem to be able to
find a resolution.
Matt
Re: Please help newbie with Module problem.
Posted by Dennis Stout <st...@stout.dyndns.org>.
> however when I run the following code
>
> #!c:/perl/bin/perl -w
> use Apache ();
> use Apache::Request ();
> use CGI::Carp qw(fatalsToBrowser);
> my $r = Apache::Request->new(shift);
> # my $apr = Apache::Request->new($r);
> print "Content-type:text/html\n\n";
> print "Hello, World...\n";
> print $r;
> print @INC;
>
> I receive the message
> Can't locate object method "new" via package "Apache::Request" (perhaps
> you forgot to load "Apache::Request"?) at c:\apache\cgi-bin\ap2.pl line
> 6.
mod_perl sends $r to the handler() subroutine by default. That is, if you're
using it in a PerlHandler context, like you should with anything that uses
Apache::Request.
Therefore, th ollowing should work for you.
#!/usr/bin/perl -w
use strict;
use Apache::Constants qw(:common);
sub handler {
my $r = shift;
my $result = undef;
eval { $result = inner_handler($r) };
return $result unless $@;
warn "Uncaught Exception: $@";
return SERVER_ERROR;
}
sub inner_handler {
my $r = shift;
$r->content-type('text/html');
$r->status(200);
my $html = "<html><head><title>Hello World!</title></head><body><center>You
Tried To Access URI: ". $r->uri ."</center></body></html>";
$r->send_http_header;
print $html;
}
Re: Please help newbie with Module problem.
Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2003-07-02 at 11:50, Matt Corbett wrote:
> I need to use the Apache::Request module on a range of programs to use
> POST and GET methods in my HTML to process information gathered.
Actually, you don't. You can use CGI.pm, CGI::Simple, CGI_Lite, etc.
for this.
If you want to use Apache::Request but can't get your own compile to
work, try one of the pre-compiled binaries available here:
http://perl.apache.org/download/binaries.html
- Perrin
Re: Please help newbie with Module problem.
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Wed, 2 Jul 2003, Matt Corbett wrote:
> Dear List,
> I have got a problem that I can't fix no way, no how.
>
> I am porting a Linux website to xp pro.
> I need to use the Apache::Request module on a range of
> programs to use POST and GET methods in my HTML to process
> information gathered.
>
> The port I am using is the Activestate Apache/1.3.27 (Win32)
> mod_ssl/2.8.14 OpenSSL/0.9.7b mod_perl/1.27_01-dev
>
> I have installed 'Apache::Request with perl -MCPAN -e "shell"' and
> 'install Apache::Request' . and if I try to run the install I get a
> message saying 'Apache::Request is up to date'
> I dont seem to be able to test the module becuase I cannot
> make it with NMAKE.EXE, is this necessary. I use nmake15.exe
> should I be using a later one.
To build the module, you'll need a C compiler (Visual C++ 6, if
you want compatibility with ActivePerl). But since CPAN.pm
believes Apache::Request is up to date, you probably have a
working version, in principle. Does
C:\> perl -MApache::Request -e "print 1"
produce any error?
> The @INC is c:\perl\lib and c:\perl\site\lib
>
> The request.pm is in /perl/site/lib/apache
>
> however when I run the following code
>
> #!c:/perl/bin/perl -w
> use Apache ();
> use Apache::Request ();
> use CGI::Carp qw(fatalsToBrowser);
> my $r = Apache::Request->new(shift);
> # my $apr = Apache::Request->new($r);
> print "Content-type:text/html\n\n";
> print "Hello, World...\n";
> print $r;
> print @INC;
> I receive the message Can't locate object method "new" via
> package "Apache::Request" (perhaps you forgot to load
> "Apache::Request"?) at c:\apache\cgi-bin\ap2.pl line 6.
This script ran fine for me under Apache::Registry with
ActivePerl 635 / mod_perl 1.27 / Apache 1.3.27. From where are
you running it? And does a simple Apache::Registry script that
just prints out "Hello" work from the same location?
--
best regards,
randy kobes