>>>>> "Douglas" == Douglas Wilson <[EMAIL PROTECTED]> writes:
Douglas> That gives me a 'Variable "$counter" may be unavailable at ./tst2 line 17.'
Douglas> warning. And its sort of obfuscated (to me, anyway). I'd probably do it this
Douglas> way:
Douglas> #!/usr/local/bin/perl -w
Douglas> use strict;
Douglas> #!/usr/bin/perl -w
Douglas> use strict;
Douglas> for (1..3){
Douglas> print "run: [time $_]\n";
Douglas> run();
Douglas> }
Douglas> {
Douglas> my $counter;
Douglas> sub run {
Douglas> $counter = 0;
Douglas> print $counter,"\n";
Douglas> increment_counter();
Douglas> increment_counter();
Douglas> }
Douglas> sub increment_counter {
Douglas> $counter++;
Douglas> print "Counter is equal to $counter !\n";
Douglas> }
Douglas> }
But *that* won't work inside the big subroutine created by
Apache::Registry (which is NOT the same as mod_perl, even though too
many people think so :), and that was the original point. I'm
not sure the new code fixes it. I think the problem is intractable,
or equivalent to the Travelling Salesman and the Farmer's Daughter
problem or something like that. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!