in reply to threads::shared and DBI fetchrow_hashref

I'm getting an "Invalid value for shared scalar" error...

The hashref returned by $sth->fetchrow_hashref() is not shared, and you cannot store unshared data in a shared data structure. (Obviously:)

You can avoid the problem by sharing the unshared data before assigning it to the shared data structure:

$aCache{$cacheKey} = shared_clone( $sth->fetchrow_hashref() );

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: threads::shared and DBI fetchrow_hashref
by matonb (Initiate) on May 27, 2011 at 09:08 UTC

    Thank you BrowserUK, I was just about to update this thread with shared_clone being the solution!

    At least you've confirmed what I eventually worked out :)