--- [EMAIL PROTECTED] wrote:
> I finally got around to writing a little program to prevent
> you stubbing your putter into the ground behind the ball
> when attempting to smoothly stroke a one inch putt into
> the hole.
v. cool. Got two strokes off me! A couple of amendments to Mr. Magoo, to
automatically limit cpu time (unix/cygwin only):
! my ($real_time) = `cp $too_fat_prog $hole_prog;/usr/bin/time -p $^X
$test_prog 2>&1`=~/^real\s+(\d[.\d]*)/m;
! my $max_time = int($real_time * 2);
! print "Limiting CPU time to $max_time\n";
!
my $sidx = 7; # "#!perl " or "#!perl\n"
my $eidx = length($too_fat) - 1;
for my $i ($sidx .. $eidx) {
# next if $i == 72; # eugene.pl (hack if program hangs)
my $lose_some_weight = $too_fat;
! $lose_some_weight =~ s/(.{$i})(.)/$1/s;
my $ch = $2;
print "i=$i '$ch' prog='$lose_some_weight'\n";
{ open(my $fh, '>'.$hole_prog) or die "open '$hole_prog': $!";
print $fh $lose_some_weight;
}
! my $s = `ulimit -t $max_time; $^X $test_prog 2>&1`;
Think it's easiest to just use realtime, at least on solaris, unless you know a
good way to gather the cpu time of child processes that the tpr test script
will create.
now how about a quotes/sig file with one line descriptions of golf aphorisms?
here we go:
~$a -- true if ASCII string is non-empty, works for "0"
[$a^abc] -- toggle a charset by making $a non-empty
$|++ -- alternately 0 and 1
$^I -- variable efficiently initialised with -i
perl -[np] -e 'every line}once;for(list){' -- exploit -n or -p
Greg
__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute