I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-02-24 08:49:59.100953-08 by shammi000
Share a temporary table between child process
Hi All,
I am running an application, which is build on Net::Server::PreFork. Currently it creates 4 +child process, and i want all the child process to access a temporary table created psql. How can +i do it ?. Precisely, I want to create a temporary table in the main application and all the child process + should have access to it (The table should be in existence till the application is up). I tried to create the table in post_configure_hook (custom, override) but it is not working. In + which function i can add the code to create the table. Regards, Shameem
Direct Responses: 12479 | Write a response
Posted on 2010-02-26 04:50:33.827565-08 by monkeyvegas in response to 12457
Re: Share a temporary table between child process
Which came first, the Perlmonks or the CPAN::Forum question? heh. As the answer there states, DBD::Pg is not able to be accessed from multiple processes concurrently, so the suggestions to use a permanent table, or use Net::Server::Multiplex seem fair. You could also use some form of IPC to marshall access to the database so that it occurs only in the parent (which may defeat the purpose of using a forking server though, if your main point of blocking is writing to the database).

Also worth noting is that DBD::Pg supports asynchronous operations, so you could use asynchronous operations on a single DBD::Pg handle and use IO::Multiplex instead of PreFork if writing database records was the major blocker.

If you are just reading from the table in your children (writing does seem a little strange, since it is to a temporary table, which will die with your session), then you could read the whole table into a hashref/arrayref in the parent and have your children access it using Perl syntax instead of DBI.

Still, I think we would need more detail to provide a more helpful answer.
Direct Responses: Write a response