Re: LWPng patch to fix binmode problems on Windows NT

Blair Zajac (bzajac@geostaff.com)
Wed, 14 Apr 1999 15:19:11 -0700


This is a multi-part message in MIME format.
--------------18F265377A98290C4AC7A5EC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Ed wrote:
> 
> On Wed, 14 Apr 1999, Blair Zajac wrote:
> > I'm including a patch below for LWP::Conn::FILE that fixes a problem
> > when LWPng is used on Windows systems and either binary or text files
> > are being read from local disk.  The current code would never read
> > the file in binary mode and hence could not read binary data containing
> > control-Z's.  The patch below uses the guess_media_type subroutine
> > to switch the reading of the file into binary using binmode unless
> > the file is of a type text.  The code may need to be adopted more
> > as other
> 
> I do not think this is the right approach. Much better would be to
> binmode always, and let any code that wants to turn DOS text into
> Unix text can do so with an s///.

This sounds like the hard way.  When I looked at the guess_media_type
subroutine, it will only return text/* on a few type of files.  So in
the end, the file mode will most likely end up in binary mode.

Also, this way the users of the code do not have to worry about turning
DOS text into Unix text.  It happens in the background and that's the
way I would like it.

Blair
--------------18F265377A98290C4AC7A5EC
Content-Type: text/x-vcard; charset=us-ascii;
 name="bzajac.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Blair Zajac
Content-Disposition: attachment;
 filename="bzajac.vcf"

begin:vcard 
n:Zajac;Blair
tel;fax:310-827-8177
tel;work:310-827-3700 x1703
x-mozilla-html:FALSE
url:www.geocities.com
org:GeoCities
adr:;;4499 Glencoe Avenue;Marina del Rey;CA;90292;
version:2.1
email;internet:bzajac@geostaff.com
title:IT Analyst
x-mozilla-cpt:;-3232
fn:Dr. Blair Zajac
end:vcard

--------------18F265377A98290C4AC7A5EC--