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

Re: [MacPerl] Basic Question



On Thu, 7 Sep 2000 10:50:38 -0400, Chip G. wrote:

>I downloaded a script from a web 
>site which processes a data file to make a Palm file. I need to be 
>able to pass two arguments (file names) to the script. If I run the 
>script from the menu it produces an error because it did not have 
>those arguments). How do I pass those arguments?

If you want to pass input files, in any order: make this a droplet (= a
mini application, which will launch MacPerl and run its script), and
drop the file(s) on it.

But, I assume that you want maybe one input file, and one output file
name? You can modify the script that the output file is automatically
chosen, based upon the input filename. You can rename the file by hand.

>The Palm file, however, appeared 
>to be incorrectly formatted. That brings up another question. Can the 
>difference in file systems make it mandatory to change the original 
>script to be compatible with the Mac for making a Palm file?

A difference between platforms is the line termination characters for
text files. I suppose that can byte you. Note that "\n" on the Mac is a
CR (Ascii code 13, "\015") and "\r" LF (Ascii code 10, "\012"), while on
Unix it's just the reverse.

On a PC, Unix is emulated, but with CRLF sequences being converted into
"\n" = "\012" on input, and back on output. You need to use binmode() on
the file handle to prevent that.

It's not unlikely that this is what bites you. Modify the script so that
your script generates the actual bytes you need in the file, and apply
binmode on the filehandle. (This is a NOOP on MAc and Unix).

-- 
	Bart.

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