Maybe give the inner variable a different name and assign it the value from the "main" handle in the non-fork case?
my $main_dbh = DBI->connect(...); while( 1 ) { my $dbh; if( $forked ) { $dbh = DBI->connect(...); } else { $dbh = $main_dbh; }; $dbh->selectall_arrayref($sql); }
In reply to Re^4: Not sure how to handle this scope (updated)
by Corion
in thread Not sure how to handle this scope
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |