On 12/11/07, Alfie John <[EMAIL PROTECTED]> wrote: > > Alfie John wrote: > > > If you really don't care about it returning, you could just: > > > > > > <%init> > > > ... > > > > > > `/my/command args &`; > > > > > > ... > > > </%init> > > > > > > The backticks will fireoff the process, but the '&' will put it in the > > > background and leave you alone. > > > > > > > > > I see -- is that all? I thought that there was something bad about this > > since the documentations I've come across didn't mention this simple > > solution as a "first step". I was worried that I was overlooking > > something... > > I really don't see a problem with backticking + backgrounding if > that's the functionality you need. It is bad to fork regardless on the > way you achieve it within mod_perl since you take a performance hit > for duplicating the apache parent. However if speed is not a problem, > then backticks + backgrounding is your easiest option. > > If speed *is* a problem, then that link above to the mod_perl docs has > good examples on what to do. > > If anybody can see a problem with the above, speak up or forever hold > your peace :)
There are several problems when using 'backtick' here: 1) From my tests, be it a background or foreground command within backticks, your process has to wait for it to finish to continue. A simple Mason file can address this problem: <% rand() %> <%init> `sleep 20 &`; </%init> and see how long it takes to render your webpage. My point: if the external program takes some non-trivial time to finish, qx// and the likes are not the ways OP might need. 2) "backtick" is usually not used in a void context, this might just be a trivial Perl problem though. Regards, Xicheng ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users