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

[MacPerl] minor debugging



the following program works fine for most things. But occasionally when dealing with some odd charecters it errs. for example if you enter "/$B7uck" it resets the creator to "/%ld". If you run it again it displays the creator as a blank and automatically fails. Using a larger version of the program (with more features etc) does not run into this problem and can correct it while this one cannot. Please pardon the verbosity.

le meas,
--Nick

#!perl-w

require "GUSI.ph";


if (@ARGV) {
     $file = $ARGV[0];
} else {
     $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);
     push @ARGV, $file;
     unless ($file) { exit }
}


$orig = join "/", reverse MacPerl::GetFileInfo($file);
$_ = MacPerl::Ask($orig.'     =>     TYPE/CREA ?');
if ($_ =~ /^\/....$/) {
     $type = $orig;
     $type =~ s/\/....//;
     $creator = $_[0];
     $creator =~ s/^\///;
     MacPerl::SetFileInfo($creator, $type, $file);
} elsif ($_ =~ /^....\/....$/) {
     $type = $_[0];
     $type =~ s/\/....$//;
     $creator = $_[0];
     $creator =~ s/^....\///;
     MacPerl::SetFileInfo($creator, $type, $file);
} else {
     exit;
}
__END__

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