On Wed, 2004-04-14 at 13:38, Perrin Harkins wrote: > # Counter.pm > > sub run { > my $cgi = shift; > print "Content-type: text/plain\r\n\r\n"; > print "HERE"; > my $counter = 0; > for ( 1 .. 5 ) { increment_counter(\$counter, $cgi); } > } > > sub increment_counter { > my ($counter_ref, $cgi) = @_; > ${$counter}++; > my $str = $cgi->param("name"); > print "Name=$str Counter is equal to $counter !\r\n"; > } > > 1;
That should have been more like this: package Counter; use strict; use warnings; sub run { my $cgi = shift; print "Content-type: text/plain\r\n\r\n"; print "HERE"; my $counter = 0; for ( 1 .. 5 ) { increment_counter(\$counter, $cgi); } } sub increment_counter { my ($counter_ref, $cgi) = @_; ${$counter_ref}++; my $str = $cgi->param("name"); print "Name=$str Counter is equal to $counter !\r\n"; } 1; -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html