Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Fork-safe DBI handles via ChildHandles and InactiveDestroy

by TVNshack (Novice)
on Jul 03, 2015 at 12:08 UTC ( [id://1133086]=note: print w/replies, xml ) Need Help??


in reply to Fork-safe DBI handles via ChildHandles and InactiveDestroy

Hello,

Looks like there is a typo (that wreaked havoc on my code !)

Ought to be:

sub MakeAllDBHsForkSafe { my %drivers = DBI->installed_drivers; foreach my $drh (values %drivers) { map { $_->{InactiveDestroy} = 1 } @{$drh->{ChildHandles}}; } }

Instead of:

sub MakeAllDBHsForkSafe { my %drivers = DBI->installed_drivers; foreach my $drh (values %drivers) { map { $_->{InactiveDestroy} = 1 } @{$_->{ChildHandles}}; } }

Then, I would go for some code a bit more cautious :

sub MakeAllDBHsForkSafe { my %drivers = DBI->installed_drivers; foreach my $drh (values %drivers) { $_->{InactiveDestroy} = 1 for (grep {defined} @{$drh->{ChildHand +les}}); } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1133086]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-11-06 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    chatterbot is...






    Results (32 votes). Check out past polls.