in reply to Parallel::ForkManager question

Getting values back from forked programs can be tricky because when a program is forked, its child process is completely seperate (well, mostly) from the parent process - it just happens to be identical to it at first. Because of this, any values that you change in the child process are lost when it exits unless you somehow get them back to the parent process.

There are several ways you can do this, the easiest would be to use the exit code. However, if I remember correctly, exit codes can only be integers from 0 to 255, so that limits how much information you can pass back. Another option would be to use some form of shared memory, but that can be difficult to program. You could also have all the processes write to a file, but you should make sure to have each one obtain an exclusive lock on the file before writing to it, then close it to prevent a race condition between all the processes that are going to be using it.

Probably one of the nicest ways is to use a database. The database won't have any problem accepting connections from many multiple clients and it will take care of locking issues for you as well. The only problem is a speed tradeoff, as opening a connection to the database will take a little bit.

Just thought of another one, you could use something like syslog if you're just writing out the result of an operation.

Hope that helps!