Andrew Kingston wrote:
> Here's my HackLastSubmit() function.
>
> sub HackLastSubmit()
> {
> # LOAD INPUT FORM DATA INTO %in
> my %in;
> my $errmsg;
> my $infile = $G::lastsubmit;
>
> if ( LoadInput(\%in, $infile, \$errmsg) < 0 )
> { print "$errmsg\n"; exit(1); }
>
> $in{JobTitle} = "";
> $in{Ram} = "2048";
> $in{RetryBehavior} = "AddNever+Requeue";
> $in{Retries} = "3";
>
> if ( SaveInput(\%in, $infile, \$errmsg) < 0 )
> { print "$errmsg\n"; exit(1); }
> }
Yes, exactly!
Only suggestion is change the "print" statements to ErrorWindow(), eg:
{ ErrorWindow("$errmsg\n"); exit(1); }
..so that any errors show up in a little dialog before exiting.
Without that, in the context of being called from MAIN_Input(),
the messages would go to stdout/stderr, which won't be seen
unless the user invoked the script from a command prompt.
So if they invoke it from the Desktop and an error occurs,
without ErrorWindow(), the script will appear to silently fail,
without opening any GUIs, confusing the user (and sysadmin!)
In other contexts, such as MAIN_Submit() or MAIN_Render(),
messages printed to stdout/err are managed in a useful way.
Just not in MAIN_Input(), because no GUI has been opened yet.
--
Greg Ercolano, erco@(email surpressed)
Seriss Corporation
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)
|