Hi all,
I'm having this problem when I run a perl module at the root of my web
site. This is the snippet from httpd.conf:
<Location />
SetHandler perl-script
PerlHandler Apache::BOSCIndex
</Location>
Now, when I have a form on my web site that posts to, let's say, here:
http://my.web.site/cgi-bin/contact/contact.pl
the site does not execute, instead it just shows me the script's source
code. However, when I disable the code from httpd.conf that links root
to the module, the above script executes great from the form on the
web. Here is the module that links to the root of my web site:
-----------------------
package Apache::BOSCIndex;
# use
use strict;
use Audrey;
use Audrey::Display;
use Audrey::News;
use CGI qw(:standard);
use Apache::Constants qw(OK DECLINED);
my $q = CGI->new;
my $Audrey = Audrey->new;
my $Display = Audrey::Display->new;
my $News = Audrey::News->new;
sub handler {
my $r = shift;
# PerlTransHandler
return DECLINED unless $r->uri eq "/";
$r->handler( "perl-script" );
$r->push_handlers( PerlHandler => sub {
my $user_id = $Audrey->get_user_id( $r );
$Display->update_stats( $user_id, "Front_Page" );
# print the header
$r->content_type('text/html');
$r->send_http_header;
# load the profile
$Display->load_user( $user_id );
# now print the html
$Display->pre_main( $r, $user_id, "BeOSCentral - always" );
$News->print_news_items( $r );
$Display->post_main( $r, $user_id );
});
return OK;
}
# return true
1;
-----------------------
You'll notice that I use a PerlTransHandler, this is because without it
I have some <img> tag like this:
<img src="/images/icons/image.gif">
then it would not display the image (it was trying to execute the
module. That's why the PerlTransHandler is there. But now I have a
problem executing scripts that are linked to the root of the site, for
example:
<form action='/cgi-bin/contact/contact.pl' method=post>
And I have no idea why. Any help would be appreciated, thanks in
advance.
Regards,
Etienne