Greg Ercolano wrote:
Andrew Kingston wrote:
Still on straight 102.42 I'm afraid - must sort out upgrading one of
these days.
Wow, that's about 3 years old ;)
Time has just flown by...
There's actually easier ways to write the above using the predefined
functions LoadInput()/SaveInput() functions in .common.pl, but since
you might have even older submit scripts, I thought it best to
'spell it all out' with explicit code. If you're curious about those
two predefined functions (in .common.pl), you can just peruse the submit
scripts that use them to see how they can be used to modify the file's
contents with regex's.
Thanks for the prompt about LoadInput & SaveInput. I have used them
before to do something similar, but had totally forgotten about it.
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); }
}
Cheers
Andrew
|