[VPM] cross-platform detached process invoke method

Peter Scott Peter at PSDT.com
Sun Feb 10 17:17:39 PST 2008


At 03:44 PM 2/9/2008, Tyler MacDonald wrote:
>Jer A <jeremygwa at hotmail.com> wrote:
> > whats a way to do this? it - should work on both Windows/*nix
>
>   In the past, I've used IPC::Run3 for this.
>
> > can this be done in a cgi script, where the script exits, leaving the
> > child to exit on it's own?
>
>   Now *that* can be tricky to do in a cross-platform way. The ideal way to
>start a process in the background in Win32 is to use START.EXE (I think?
>it's been awhile)... So you could have your script check the value of $^O,
>and if it's win32, invoke START.EXE, otherwise use a shell construct to
>start a process in the background.
>
> > can this be done without loading any bulky modules?
>
>   IPC::Run3 isn't bulky. :-)
>
> > Thanks in advance for any help.

fork() was made to work on Windows some time ago (5.6.1?) in 
ActiveState Perl, so that gives you some portability.  Dunno about 
interprocess communication or stuff like shared memory.  Threads 
probably also works, haven't tried.

C:>perl -le "fork and print 'Parent ', $$ or print 'Child ', $$"
Parent 3708
Child -3384


-- 
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
http://www.perlmedic.com/




More information about the Victoria-pm mailing list