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

[MacPerl] copy files and launch apps



I'm trying to write a perl script that will copy stored preference files 
for different users and then launch the application associated with 
those prefs.

<background>
Many people use the particular Mac that I work off and want their own 
preference files for certain applications.  I would like to have a 
script that will copy joe smith's preferences into the preference folder 
over the existing generic one and then launch the app. When joe is done 
he run another script to restore the prefs to the generic file.
</background>

The following script (below) does not work for pref files, I'm assuming 
because they are binarys, I tried it on some gif files as well 
unsuccessfully.  

My question is what syntax can I use to accomplish this task?  Second 
question I've checked the faqs and learned that the:
exec ("app name");
and
@system commands do function under macperl.

How do I launch an application using macperl?

Zach-


#!perl
#read file write out new file script

unless (open(INFILE, "file1.txt")) {
        die ("cannot open file\n");
}

unless (open(OUTFILE, ">file2.txt")) {
        die ("cannot open outfile\n");
}
$line = <INFILE>;
while ($line ne "") {
        print OUTFILE ($line);
        $line = <INFILE>;
}