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

[MacPerl] GUSI and mime converting



Still dawdling with my first program (the mime one) Below is the main part of
my program (less the actual subroutines). When I asked how to make a popup
window to select a file with I was shown code similer to what's in the unless
clause. Unfortunately its workings weren't explained and I get an error saying
'types' is only used once, then it quits.

--nick

#!perl -w

require "GUSI.ph";

unless (@ARGV) {
     $prompt = "Select a file...";
     $default = "Wild Colonials:Desktop Folder:";
     $file = MacPerl::Choose(&GUSI::AF_FILE, 0, $prompt,
          &GUSI::pack_sa_constr_file(@types),
          ($default ? &GUSI::CHOOSE_DEFAULT : 0),$default);
}

foreach $file (@ARGV) {
     print "\n","###############\n", $file, "\n";
     print join "/", reverse MacPerl::GetFileInfo(@ARGV);
     print "\n###############\n";

     BEGINNING:
     $type = MacPerl::Ask('Type?');
     if ($type eq 'die') {die "\n####################\n"}
     if ($type eq 'list') {
          mime_list();
          goto BEGINNING;
     }
     if ($type eq 'list all') {
          mime_list_all();
          goto BEGINNING;
     }
     mime_print();

     $creator = MacPerl::Ask($type.'/Creator?');
     MacPerl::SetFileInfo($creator, $type, $file);
     print "\n####################\n";
}

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