tshabet has asked for the wisdom of the Perl Monks concerning the following question:
OK, fair enough. The code works nicely, spits out a little counter number and displays the code block currently being processed. So I found this pretty handy if/when a piece of sample input went into an infinite loop or something, I could actually see it not changing. Now what I'd like to offer other users of this code is the ability to stop/start the code while in the loop above, so that they could actually stop the output, look at the half processed block, then start it again. I figure this would be handy for folks trying to understand the way the tool works, plus handy for people trying to debug a problem with the way my code and their input interact. So how to best implement this? I've looked at the sleep() function, which could be cool. Should I just put a sleep(10) in an if(the foo key is struck) type of statement within the while loop? If this isn't practical or possible without big problems for the code, no biggy. I'm just wondering if anyone has already dealt with this problem in their own work and found a neat solution. Thanks Monks!while($next = (extract_bracketed($text, '{}', '[^{}]*' ))[0]) { $holder = $next; $next =~ s/\{([\w|-]*)(.*)\}/<$1>$2<\/$1>/osi; $text =~ s/$holder/$next/sgi; print "Sync check \#$counter\n"; print "$next\n"; $counter++; }
|
---|
Replies are listed 'Best First'. | |
---|---|
(jeffa) Re: How can a user pause a running script?
by jeffa (Bishop) on Aug 09, 2001 at 22:08 UTC | |
Re: How can a user pause a running script?
by bikeNomad (Priest) on Aug 09, 2001 at 22:09 UTC | |
by mischief (Hermit) on Aug 09, 2001 at 22:33 UTC | |
by scain (Curate) on Aug 09, 2001 at 23:28 UTC | |
Re: How can a user pause a running script?
by scain (Curate) on Aug 09, 2001 at 22:05 UTC | |
Re: How can a user pause a running script?
by tshabet (Beadle) on Aug 09, 2001 at 22:41 UTC |