talexb has asked for the wisdom of the Perl Monks concerning the following question:

Following on from my first post on this subject, I've now found that IPC::Run does indeed work absolutely fine from the command line with the legacy Perl code that I'm using .. but the same Perl module does not work from within mod_perl, choosing instead not to return from IPC::Run's 'start' method.

Good old strace (hey, I'm an assembler guy from way back) reports that Something Bad Happened roughly in the area where the pseudo-ttys are being opened -- I see an Illegal seek when file descriptors 10 and 11 (/dev/ptmx and /dev/pts/3, respectively) are being addressed. There's also a cryptic read(12, "Can\'t locate object method \"CLOS"..., 10000) = 124 which is reminscent of the error I was getting from Apache::RequestRec earlier.

If someone has managed to get IPC::Run working under mod_perl, please let me know how .. otherwise, let this be a warning that Heere There Be Dragons. :) I would like to thank perrin for his suggestions and assistance here and on the mod_perl list -- I think this is one combination of technologies that just doesn't work, and I guess I'll be working on the Complicated Solution instead.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re: Trying to use IPC::Run under mod_perl (2)
by jfroebe (Parson) on Dec 16, 2006 at 00:32 UTC

    To the best of my knowledge, what you are trying to do can't be done within mod_perl. This is because mod_perl will restrict access to the underlying os and the IPC::Run will not be allowed to execute. You will need to do it outside of mod_perl.

    What you would be better off doing is to run a local daemon (running on localhost for example) that creates the pdf/ps/whatever file. Your mod_perl app would contact the daemon to construct the file. This will reduce the security risk significantly as well as the memory that mod_perl uses doesn't unnecessarily grow. Remember that mod_perl doesn't release the memory back to os.

    hope this helps

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1