Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 cooling their heels in the Monastery: (9)
As of 2024-04-23 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found