You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sumit Shah <ss...@gce2000.com> on 2006/09/12 00:42:55 UTC
MOD_PERL - Apache2 configuration issue
Hello,
I have created a very simple perl module (MyApache2::NewMod) using h2xs
and installed it inside /usr/lib/Perl5.
Following is the source:
#file MyApache2/NewMod
package MyApache2::NewMod;
use strict;
use warnings;
sub handler {
#Open a file for writing
open(FH, "> test.txt") or die $!;
print FH "Hello World !!!\n";
}
1;
__END__
If you see all its doing is opening a new file and writing 'Hello World
!!!'. I have included inside Apache2 (global section in httpd.conf) as
follows:
PerlModule MyApache2::NewMod
PerlPostReadRequestHandler MyApache2::NewMod
When I bounce Apache and hit the server, it does create the file
(test.txt) but does NOT write to that file. I would appreciate if you
could tell me what I am doing wrong.
Thanks
Sumit
Re: MOD_PERL - Apache2 configuration issue
Posted by Michael Peters <mp...@plusthree.com>.
Sumit Shah wrote:
> #Open a file for writing
> open(FH, "> test.txt") or die $!;
> print FH "Hello World !!!\n";
print can fail. You should check that it's succeeding:
print FH "Hello World !!!\n" or die $!;
--
Michael Peters
Developer
Plus Three, LP
Re: MOD_PERL - Apache2 configuration issue
Posted by Tom Schindl <li...@bestsolution.at>.
Sumit Shah schrieb:
> Hello,
>
> I have created a very simple perl module (MyApache2::NewMod) using h2xs
> and installed it inside /usr/lib/Perl5.
>
> Following is the source:
>
> #file MyApache2/NewMod
> package MyApache2::NewMod;
>
> use strict;
> use warnings;
>
> sub handler {
>
> #Open a file for writing
> open(FH, "> test.txt") or die $!;
> print FH "Hello World !!!\n";
>
> }
>
> 1;
> __END__
>
> If you see all its doing is opening a new file and writing 'Hello World
> !!!'. I have included inside Apache2 (global section in httpd.conf) as
> follows:
>
> PerlModule MyApache2::NewMod
> PerlPostReadRequestHandler MyApache2::NewMod
>
> When I bounce Apache and hit the server, it does create the file
> (test.txt) but does NOT write to that file. I would appreciate if you
> could tell me what I am doing wrong.
>
> Thanks
> Sumit
I think you need to put your configure lines into a <directory>,
<location> or <file>-section.
Tom