Skip to main content.
home | support | download

Back to List Archive

Re: dirTree.pl

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Mon Nov 17 2003 - 18:58:13 GMT
On Sun, Nov 16, 2003 at 04:44:36PM -0800, Lee Thompson wrote:
> Bill,
> 
> Thanks, using the file stat was indeed giving me the wrong content
> length, instead for Windows I can read <FH> filehandle to a $variable
> and and use length($variable) for the content-length header.

Yes, of course.  The stat() call is returning the size of the file on
disk, which has DOS line endings.  Both Perl and Swish-e are opening the
files in text mode, so when DirTree.pl reads in the file the line
endings are converted to a single newline character.

When DirTree.pl writes it to swish the text is written in text mode, so
the newlines are replaced with the \r\n DOS lines, but then swish-e
reads that in and again the newlines are stripped.

So using the length() is correct for non-multibyte characters.

I'll fix DirTree.pl for 2.4.1 update.



-- 
Bill Moseley
moseley@hank.org
Received on Mon Nov 17 18:58:20 2003