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

Re: [MacPerl] Re: Newline



I'm not sure what the problem is. When I move a script to the Mac I drop
it on a simple droplet to convert it to the Mac format. If I have a file
on my unix machine (Mac CI, netbsd) or my ISP (Sun 4.1x or so) I pass
it through a perl filter. I don't do windows but I have a droplet on
the mac to corrupt files into the two char eol required if I am sending
something to an unfortunate that has a wintel machine. I do ftp everything
in binary mode. If I used text mode I wouldn't need to convert. The
following is the droplet I use to convert anything except EPDIC to Mac
format:

#!/usr/bin/perl
# to_mac  (unix & dos to mac) filter
$cl_arguments = @ARGV;
if ( $cl_arguments > 0 ) {
	   @filenames = @ARGV;
 
    $pathname = $filenames[0];
    $pathname =~ s/:[^:]*$/:/;

    for (@filenames) {
	      next if $_ eq '.';
 	     next if $_ eq '..';
       $fname = $_;
       $tempfile = $pathname."tempfile";
       open(TEMP, ">".$tempfile);
       open(THISFILE,$fname);
       $fname =~ s/$pathname//;
       undef $/;                               # I want it all!
       $pin = <THISFILE>;
       $pin =~ s/\015\012/\015/gs;             # DOS to Mac
       $pin =~ s/\012/\015/gs;                 # *nix to Mac
       close(THISFILE);
       print TEMP $pin;
       close(TEMP);
       unlink($pathname.$fname);
       rename($tempfile,$pathname.$fname);
       MacPerl::SetFileInfo("R*ch", "TEXT",$pathname.$fname);
       $/ = '\n';                              # restore $/ (may need someday)
   }
}

In message <v03110707b0671448d29a@[192.168.0.3]> Dan Herron writes:
> One possibility is if you have the scripts stored on a Unix box running
> NetAtalk (or maybe CAP, not sure about that.) That way you could mount a
> Mac volume (living on the Unix box) with the scripts there, and make sure
> text translation is on (to convert CR's). MacPerl quite happily opens files
> that are written on Unix with unix-style CR's, as long as you set .pl to be
> type TEXT. Might be more trouble that it's worth if your not already such a
> setup, but it's a nice feature.
> 
> At 3:30 PM -0700 10/12/97, Mark F. Murphy wrote:
> >By having to translate the text file to Mac first, I now have to maintain
> >two sets of scripts.... one for Unix and one for Mac.
> 
> BTW, anybody else getting errors when posting to the list?, as such:
> 
> >From: Mailer-Daemon@arena.de (Mailer-Daemon)
> >Date: Mon, 13 Oct 1997 00:17:05 +0100
> >Subject: NDN: Re: [MacPerl] MacPerl/Alpha hangs
> >Organization: arena.medien
> >X-Gateway: FirstClass Gateway for SMTP/NNTP (Mac68K) version 1.02
> >
> >Sorry. Your message could not be delivered to:
> >
> >macperl,rhett (The name was not found at the remote site. Check that the 
> name
> >has been entered correctly.)
> 
> -dan
> 
> 
> 
> ***** Want to unsubscribe from this list?
> ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch


-------------
Dick Barker    dickb@eskimo.com    http://www.eskimo.com/~dickb/
Are you qualified to join OFDA?  http://www.eskimo.com/~dickb/ofda.html
San Juan Isl Dive Charter? http://www.eskimo.com/~dickb/starfire.html


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch