in reply to pass $dbh object to new program
A DBI handle contains a bit (or a lot, depending on the particular DBD backend it's using) of context which may not even be valid in another process' context. Passing it (or in your case a stringified representation of it) to another process on the command line isn't going to work (depending on the DBD and what backend library it uses you might could do some wicked file descriptor voodoo in the child, but that's going to be highly DBD and database dependent if it's even possible). If it truly must be a separate process then you're going to have to reconnect in the child to the same database (in which case you could pass the DSN and credentials to it). Or rework your design so that the other code is a module or something you can run via do instead of spawning a new process.
|
|---|