|
Hi, A while back I posted an issue that I was having with
mod_perl 2.0 regarding file handles. Today I found an interesting clue to the
problem. In my test script below I’m opening the same file twice
in a row on purpose without closing it.
I’m trying to replicate a possible error condition where the file
might not be closed properly. When
I run this script on Apache 1.3 outside of Mod_Perl it works fine. When I run this script on Apache 1.3
with Mod_Perl 1.0 it works fine. When
I run this script under Apache 2.0 Mod_Perl 2.0 it breaks (I’m on Red Hat
Linux). Basically on the 2nd
open the file offset does not start at the beginning of the file as it does in
my other tests. Further more it is
not consistent but starts doing the Mod_Perl weirdness of sometimes working and
sometimes not. The code that is breaking has been working for years but has
started to show errors when run under Mod_Perl 2.0 Apache 2.0. Does anyone know what might have changed in Mod_Perl 2.0 to
have caused this problem? Thanks for your help,
Justin Here is my test script: my $strCGIPath = ""; if ((exists($ { #Get
absolute path to cgi-bin $strCGIPath
= $ } $strCGIPath
=~ s/\/test.pl//; my $strFileName = $strCGIPath . "/" .
"test.txt"; open (QUESTIONFILE,'<' . $strFileName) or print "Cant find file"; binmode QUESTIONFILE; #Get
first line $_
= <QUESTIONFILE>; open (QUESTIONFILE,'<' . $strFileName) or print "Cant find file"; binmode QUESTIONFILE; seek QUESTIONFILE, 0, 0; #Get
first line $_
= <QUESTIONFILE>; print $_; |
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.