in reply to Re: DBI bind_param_inout trick
in thread DBI bind_param_inout trick

I wasn't all that sure about it either, but it worked, so I shared. And I might use it in a pattern, where, I often insert from some hash in some loop, and I can set some constant values before the loop, and then set the changing values and execute the statement within the loop. I don't expect any more debugging problem there than I've ever had before, but we'll see... ;-)

Replies are listed 'Best First'.
Re^3: DBI bind_param_inout trick (local)
by tye (Sage) on Aug 23, 2012 at 00:58 UTC

    Here is a pattern that I'm pretty sure would break it:

    if( ... ) { # Over-ride default just for now: local $hsh{status} = 'backlog'; $sth->execute(); ... }

    Just FYI, as the most mundane thing that occurred to me when trying to think of ways this might break or just surprise someone. delete would also be a no-no (but I found that unlikely to be a 'trap').

    Hash values are actually pretty "stable" regarding references to them, as far as I can imagine. :) (But, yes, I'd only use this trick within a fairly small scope.)

    - tye