Hi everyone,

Recently I have ported my Apache server to mod_perl and the server is
working fine. I can say this by checking the error log and it says:

[Fri Oct 26 10:52:16 2007] [notice] SIGHUP received.  Attempting to restart
[Fri Oct 26 10:52:17 2007] [warn] module mod_php4.c is already added,
skipping
[Fri Oct 26 10:52:17 2007] [notice] Apache/1.3.33 (Darwin) PHP/4.3.9
mod_perl/1.26 configured -- resuming normal operations
[Fri Oct 26 10:52:17 2007] [notice] Accept mutex: flock (Default: flock)

And I am running this Apache on MAC. The entries for mod_perl in httpd.conf
is as follows:

Alias /perl /docroot/cgi-perl
PerlModule Apache::Registry
<Location /perl>
   SetHandler     perl-script
   PerlHandler    Apache::Registry
   PerlSendHeader On
   Options        +ExecCGI
</Location>

Problem

I am trying to create mod_perl based appln using CGI::Application and I am
just printing a message. Here is the Perl Module Test.pm, which will be
loaded.


package Test ;
use strict;
#our @ISA = qw[ CGI::Application ];
use base 'CGI::Application';

sub setup {

   my $self = shift;
   $self->run_modes( 'mode1' => 'mode1_sub' );
   $self->start_mode( 'mode1' );

}

sub mode1_sub {

   my $self = shift;
   my $req = $self->query();

   $req->content_type( 'text/html' );
   $req->send_http_header;

   return "using CGI::Application and mod_perl";
}

1;

Here is my CGI Script test.cgi:

use strict;
use lib '/docroot/cgi-perl/test';
use Test;

my $webapp = Test->new();
$webapp->run();

Both the CGI script and the module are in same directory. I am getting
following error message in my error log and I am just could not understand,
where I am doing wrong. 

[Fri Oct 26 11:05:39 2007] [error] Can't locate object method "new" via
package "Test" at /docroot/cgi-perl/test/test.cgi line 5.\n

Please guide me in this regard and it will be great help for my application.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/mod_perl-and-CGI%3A%3AApplication..-Strange-Behaviour-tf4697759.html#a13428708
Sent from the mod_perl - General mailing list archive at Nabble.com.

Reply via email to