perl + automode.o

Gerrit P. Haase
Sat Aug 25 14:20:00 GMT 2001

Charles Wilson schrieb am 2001-08-25, 13:59:

>(1) Using Unix-line-endings on Unix(binary) mounts:
>      no problem
>(2) Using DOS-line-endings on DOS(text) mounts
>      no problem?

Seems to work.

>(3) Using Unix-line-endings on DOS(text) mounts
>      no problems reading, but output files get extraneous ^M's on disk. 
>  That's okay though, because perl can still read them in (case >2 above)

Seems to work o.k.

>(4) Using DOS-line-endings on binary mounts
>      main problem.

Huh, could you provide an example?

I thought the main problem is using everything on textmounts, because 
at the outputs are '\r' attached, everytime an output is made, thats also
a kind of automode, but in the wrong direction. It seems to me, that the
perl interpreter looks what mount type it is on and then automagically
writes in that format, but it does it wrong.  If a file has '\r\n' at the
end of a line, there is another '\r' attached and again if the same 
procedure is repeated, so you get '\n\r\r\r\r\r\r\r' someday.

I see no problems with the automode.o built in.  I read in dosfiles on 
text and binary mounts and perl wrote them back as they are, in 'binary'
 mode, yes, but perl don't care about mount options no more, if it reads
 in '\n\r' in it puts the same out again, nothing additional attached, 
just like it should be.

Christopher Faylor schrieb am 2001-08-25, 14:28:
>On Sat, Aug 25, 2001 at 01:59:17PM -0400, Charles Wilson wrote:
>>Maybe Chris' chomp() suggestion is the right thing.
>Except for the scripts that are still using chop(), of course.

If i want to use such a script like it was posted, there should be
no need to use chomp(), this works with automode.o and no chomps, no matter
if file2.txt is text- or binmode, no matter if i'm on a text- or binmount.

# - testscript


while(<F1>) {
    # have to use chomp; chop; print F2 $_ . "\n"; to get it to work
    print F2;



More information about the Cygwin-apps mailing list