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

Re: [MacPerl] Converting From Unix to Mac



On 2/16/98 Jon S. Jaques wrote:

>Still, though, maybe a module could be put together that could be run on
>all versions of Perl (Homogenous.pm?) and would give the programmer a
>standard set of methods for hiding the OS.
>
>On a simpler concept, I am working on hiding path problems by using a
>variable for the path deliminator, and setting the variable based upon
>environment variables.

This is what I've done:

### localization stuff ####################

  # specify your operating system

 $os    = 'Mac';               # Mac, DOS, or Unix

  # specify HTML file extension

 $html = '.html';              # Mac, Unix, (Win95?)
#$html = '.htm';               # DOS

  # specify end-of-line character(s)

 $eol  = "\015\012";           # DOS
#$eol  = "\015";               # Mac
#$eol  = "\012";               # Unix

###########################################

Then somewhere lower down...

$dir = $ARGV[0] or die "No file(s) specified!\n";
$os =~ /mac/i and $dir =~ s/(.*:).*/$1/;
$os =~ /dos/i and $dir =~ s/(.*\\).*/$1/;
$os =~ /unix/i and $dir =~ s/(.*\/).*/$1/;
chdir("$dir") or die "Can't change directory $dir!\n";

RR

__________________________________________________________________________
  Richard Rathe, MD                              rrathe@dean.med.ufl.edu
  University of Florida                      http://www.medinfo.ufl.edu/
 



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