You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by GZ Dark <gz...@hotmail.com> on 2006/09/28 10:45:03 UTC

A newbie modperl problem

At first I'll say sorry that have no experience for writting the modperl 
handler.
When I wrote a simple handler like:

$ cat CorpFB/Feedback.pm 
package CorpFB::Feedback;
use Apache::Constants qw(:common);
use strict;
use Apache::Request();

sub handler {

    my $r = shift;
    
    $r->send_http_header('text/html');
    $r->print("<p>Test");

    return OK;
}

1;

The CorpFB/Feedback.pm is under the directory of '/home/apache1.3/cgi' 
which exist in the startup.pl:

$ cat lib/startup.pl 
use strict;

use lib '/home/apache1.3/cgi';
$ENV{MOD_PERL} or die "not running under mod_perl!";
...
1;


Here are the modperl config pieces in my httpd.conf:

PerlRequire  /home/apache1.3/cgi/lib/startup.pl
Alias /fbl/ "/home/apache1.3/fbl/"
PerlModule  CorpFB::Feedback

<Location /fbl>
    SetHandler perl-script
    PerlHandler CorpFB::Feedback
</Location>



Ok,when I access the url with:
http://www.xxx.tld/fbl

I got the errors in error_log:

[Thu Sep 28 16:32:53 2006] [error] Undefined subroutine 
&CorpFB::Feedback::handler called.\n


Could you help me with it?Thanks.



Re: A newbie modperl problem

Posted by Malcolm J Harwood <mj...@liminalflux.net>.
On Thursday 28 September 2006 04:45, GZ Dark wrote:

> At first I'll say sorry that have no experience for writting the modperl
> handler.
> When I wrote a simple handler like:
>
> $ cat CorpFB/Feedback.pm

> The CorpFB/Feedback.pm is under the directory of '/home/apache1.3/cgi'
> which exist in the startup.pl:

Is "/home/apache1.3/cgi" in your perl library path?


Re: A newbie modperl problem

Posted by Jordan McLain <jo...@gmail.com>.
It seems from your message that Feedback.pm is in /home/apache1.3/fbl/.
Feedback.pm needs to be in /home/apache1.3/fbl/CorpFB/.

Jordan

On 9/28/06, GZ Dark <gz...@hotmail.com> wrote:
> At first I'll say sorry that have no experience for writting the modperl
> handler.
> When I wrote a simple handler like:
>
> $ cat CorpFB/Feedback.pm
> package CorpFB::Feedback;
> use Apache::Constants qw(:common);
> use strict;
> use Apache::Request();
>
> sub handler {
>
>     my $r = shift;
>
>     $r->send_http_header('text/html');
>     $r->print("<p>Test");
>
>     return OK;
> }
>
> 1;
>
> The CorpFB/Feedback.pm is under the directory of '/home/apache1.3/cgi'
> which exist in the startup.pl:
>
> $ cat lib/startup.pl
> use strict;
>
> use lib '/home/apache1.3/cgi';
> $ENV{MOD_PERL} or die "not running under mod_perl!";
> ...
> 1;
>
>
> Here are the modperl config pieces in my httpd.conf:
>
> PerlRequire  /home/apache1.3/cgi/lib/startup.pl
> Alias /fbl/ "/home/apache1.3/fbl/"
> PerlModule  CorpFB::Feedback
>
> <Location /fbl>
>     SetHandler perl-script
>     PerlHandler CorpFB::Feedback
> </Location>
>
>
>
> Ok,when I access the url with:
> http://www.xxx.tld/fbl
>
> I got the errors in error_log:
>
> [Thu Sep 28 16:32:53 2006] [error] Undefined subroutine
> &CorpFB::Feedback::handler called.\n
>
>
> Could you help me with it?Thanks.
>
>
>