From: sln on
On Fri, 11 Jun 2010 12:48:17 -0500, John Bokma <john(a)castleamber.com> wrote:

>Tad McClellan <tadmc(a)seesig.invalid> writes:
>
>> Use binmode on binary files.
>>
>> Do not use binmode on text files.
>
>/unless/ you want the data as it is on disk, for example to
>calculate a check sum.
>
Semantics! You wouldn't create a check sum on a text file.
Otherwise it wouldn't be a text file, it would be
a binary file.

-sln
From: John Bokma on
sln(a)netherlands.com writes:

> On Fri, 11 Jun 2010 12:48:17 -0500, John Bokma <john(a)castleamber.com> wrote:
>
>>Tad McClellan <tadmc(a)seesig.invalid> writes:
>>
>>> Use binmode on binary files.
>>>
>>> Do not use binmode on text files.
>>
>>/unless/ you want the data as it is on disk, for example to
>>calculate a check sum.
>>
> Semantics! You wouldn't create a check sum on a text file.
> Otherwise it wouldn't be a text file, it would be
> a binary file.

Is that so? So if I calculate a MD5 digest over a text file to check its
integrity it magically becomes a binary file? Even if I add the checksum
to the end of the text file, it still can be a text file.

--
John Bokma j3b

Hacking & Hiking in Mexico - http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development
From: Uri Guttman on
>>>>> "JB" == John Bokma <john(a)castleamber.com> writes:

JB> sln(a)netherlands.com writes:
>> On Fri, 11 Jun 2010 12:48:17 -0500, John Bokma <john(a)castleamber.com> wrote:
>>
>>> Tad McClellan <tadmc(a)seesig.invalid> writes:
>>>
>>>> Use binmode on binary files.
>>>>
>>>> Do not use binmode on text files.
>>>
>>> /unless/ you want the data as it is on disk, for example to
>>> calculate a check sum.
>>>
>> Semantics! You wouldn't create a check sum on a text file.
>> Otherwise it wouldn't be a text file, it would be
>> a binary file.

JB> Is that so? So if I calculate a MD5 digest over a text file to check its
JB> integrity it magically becomes a binary file? Even if I add the checksum
JB> to the end of the text file, it still can be a text file.

it matters on winblows. if you just open a text file with no binmode and
pass the handle to a checksum sub, it will not calculate a proper sum
for the file itself. the cr/lf pairs will become newlines and the sum
will be different than if done on the raw file.

uri

--
Uri Guttman ------ uri(a)stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
From: sln on
On Fri, 11 Jun 2010 16:07:01 -0500, John Bokma <john(a)castleamber.com> wrote:

>sln(a)netherlands.com writes:
>
>> On Fri, 11 Jun 2010 12:48:17 -0500, John Bokma <john(a)castleamber.com> wrote:
>>
>>>Tad McClellan <tadmc(a)seesig.invalid> writes:
>>>
>>>> Use binmode on binary files.
>>>>
>>>> Do not use binmode on text files.
>>>
>>>/unless/ you want the data as it is on disk, for example to
>>>calculate a check sum.
>>>
>> Semantics! You wouldn't create a check sum on a text file.
>> Otherwise it wouldn't be a text file, it would be
>> a binary file.
>
>Is that so? So if I calculate a MD5 digest over a text file to check its
>integrity it magically becomes a binary file? Even if I add the checksum
>to the end of the text file, it still can be a text file.

Haha! Its funny but after you validate the integrity with a checksum, it
reads different when read in text mode depending on the OS.
Semantics..

-sln
From: Tad McClellan on
sln(a)netherlands.com <sln(a)netherlands.com> wrote:
> On Fri, 11 Jun 2010 12:48:17 -0500, John Bokma <john(a)castleamber.com> wrote:
>
>>Tad McClellan <tadmc(a)seesig.invalid> writes:
>>
>>> Use binmode on binary files.
>>>
>>> Do not use binmode on text files.
>>
>>/unless/ you want the data as it is on disk, for example to
>>calculate a check sum.
>>
> Semantics! You wouldn't create a check sum on a text file.


I create checksums on text files fairly often.


> Otherwise it wouldn't be a text file, it would be
> a binary file.


Nonsense!

What makes you think that taking a checksum changes a file's type?


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.