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

Reply via email to