You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jeff Crist <je...@crist.com> on 2002/08/11 09:11:15 UTC

File Problems in Perl-Run?

We recently migrated to modPerl, but only the Perl-Run parser (not
Apache::Registry) to maintain compatibility while I clean up the
scripts.  We are seeing an abnormal behavior when reading files, very
randomly (maybe about 1 out of 20 times) only the first line of the file
is read.  The code looks something like:

open (FILE, "<$path/$filename");
@lines = <FILE>;
close FILE;

The file contains about 50 lines with each line containing values
separated by commas.  Normally, this routine returns a 50 element array
@lines with all the lines in the file.  But sometimes, it just returns a
1 element array with just the first line of the file.  Very strange.
The only thing I can think of is that the old server was FreeBSD and the
new server is Linux.  Not sure if they handle file I/O differently in a
Perl environment but it seems for some reason the script things the end
of file is after the first line sometimes.

Any suggestions, ideas, would be greatly appreciated.    

Thanks!


Re: File Problems in Perl-Run?

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi there,

On Sun, 11 Aug 2002, Jeff Crist wrote:

> We recently migrated to modPerl, but only the Perl-Run parser [snip]
> randomly (maybe about 1 out of 20 times) only the first line of the file
> is read.  The code looks something like:

Hmmm.  "Something like" isn't the sort of thing we like to see here... :)

> open (FILE, "<$path/$filename");
> @lines = <FILE>;
> close FILE;

Any file locking?

Have you read the Guide?

73,
Ged.