[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MacPerl bugs?



In article <l03130302b3979d5d1262@[10.1.1.16]>, Joshua Juran <wanderer@metamage.com> writes:
> But I think it was also foolish for the Mac to use a newline that no other
> system (that I'm aware of) uses.

This decision was made some time around 1982 or 83, I would assume, and it was
not out of line with the other PCs of non-CPM/MSDOS lineages at the time.
>> transparently translated my newlines, and I wouldn't go very far out of my
>> way to make my programs work on such a perl, either.  And I know I am not
>> alone.

> Okay, what if you could set a variable or call textmode() to specifically
> request automatic translation?  No performance hit, and doesn't break
> xenophobic scripts, unless you ask for it.

Sounds good, but you would have to hash this through with perl5-porters.

> It was relatively simple to handle DOS text files by stripping leading
> linefeeds.  But how would I handle unix text files without knowing in
> advance that's what they are?  I guess I can check for a linefeed at the
> end (or anywhere, just in case) in the first line.  (DOS files don't have
> linefeeds before the first CR.)  If so, reset the file and set LF as the
> newline char.  Sounds like a pain, though, and slurps in the whole file at
> first.  Any better ideas?

The idea I had was to do something analogous to -T and -B: Count CRs and LFs in
the first block of the file.

Matthias

-- 
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
  "And that's why I am going to turn this world upside down, and make
   of it a fire so *bright* that someone real will notice"
                                -- Vernor Vinge, _Tatja Grimm's World_

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org