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

[MacPerl] Yet more on linefeeds.



ftp TEXT mode is really nice but neither of the popular browsers supports
it! You need a real ftp client these days to avoid an unchangeable default
to ftp BINARY which means that a *.pl file uploaded in TEXT mode to a UNIX
server gets downloaded by a browser with single-character <0A> linefeeds
just as the file is stored on the UNIX box. It then doesn't work as input to
Windoze perl. The extension as stored on the server makes no difference -
*.txt, *.plx, *.plx.txt all do the same thing. Apparently, in to world of
http, the only reason for ftp is to move *.html files and they don't care
about lineends.

I don't want to depend on my correspondent for handling the linefeed
changes. He has to be able to execute what I send without mucking with it.

I have prepared an MPW script to help and it's short so here it is. As usual
with the internet the 8 bit extended ASCII codes will get mucked up. You can
get the <0A> character by copying it from a PeeCee text file you surely have
around.

file "SaveForPC"
## Save item which copies the active window with an added extension
##   and then adds linefeed characters for a PeeCee to the copy.
## Resulting files should be transmitted in binary mode.
## Put this file in a directory included in {commands}.
## Put the next line, without the ##, in one of your MPW startup files
## Addmenu file 'Save for PC' 'SaveForPC'
set oldie "{Active}"
set newbie "{oldie}".peecee
duplicate -y "{oldie}" "{newbie}"
open  "{newbie}"
find  "{newbie}"
replace -c  /
/ "" "{newbie}"
  # between the slashes goes the <0A> character
find  "{newbie}"
replace -c  /n/ "n
" "{newbie}"
  # between the slashes goes OPTION-d
  # between the first pair of quotes goes OPTION-d  n  <0A> (3 characters)
save  "{newbie}"
close   "{newbie}"

Your correspondent will probably have to remove the .peecee extension
manually but at least he doesn't have to become an expert on the vagaries of
linefeeds.

This could be implemented as a perl droplet which I don't yet know how to
do. If there's interest I'll try it while perhaps learning something.


--> From the USA, the only socialist country that refuses to admit it.<--


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