Click here to get back home

Is there a way to spawn a program from perl that is independent?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Is there a way to spawn a program from perl that is independent? Tom Wyley 08-02-2008
Posted by Tom Wyley on August 2, 2008, 12:10 pm
Please log in for more thread options
That is...

Backtics and System will start up a new program but it is modal - to get
back to the original script the spawned program must be closed.

Exec kills the original script when the spawned program starts up.

I want a script to throw off another script and go on with its business.

It would appear that Fork might the the answer, but so far RTFM'ing about
Fork is getting me even more confused.

Any other way?

Thanks
Tom W

Posted by Peter J. Holzer on August 4, 2008, 8:44 am
Please log in for more thread options
> In Unix, you could background the other script in
> a subshell:
>
> 0 == system "(/path/to/other_script &)"
> or die "system failed: $?";
>
> But getting the return status of the backgrounded
> task would be messy

If you use open with mode '-|' or '|-' it isn't messy at all: close
returns the return status. It also avoids the additional shell. You need
to take care about the input or output, which may add some
complications.

        hp

Posted by comp.lang.c++ on August 4, 2008, 3:14 pm
Please log in for more thread options
>
> > In Unix, you could background the other script in
> > a subshell:
>
> > 0 == system "(/path/to/other_script &)"
> > or die "system failed: $?";
>
> > But getting the return status of the backgrounded
> > task would be messy
>
> If you use open with mode '-|' or '|-' it isn't messy at all: close
> returns the return status. It also avoids the additional shell. You need
> to take care about the input or output, which may add some
> complications.
>

True. I was just guessing from the OP's description "throw off
another
script and go on with its business", he just wanted a "spawn and
forget"
type background action. (with no interaction and possibly no concern
about status as well),

--
Charles DeRykus
Charles DeRykus


Similar ThreadsPosted
Is GD library independent? August 16, 2004, 7:45 pm
Ms-Word Ole and multiple independent instances. September 20, 2006, 5:25 am
Need to spawn an FTP process thru PERL December 17, 2004, 2:11 pm
ActiveState: Can't spawn "cmd.exe"? June 12, 2005, 2:02 pm
spawn process to run parallel March 15, 2007, 8:44 pm
Can't spawn "cmd.exe" error while using system May 9, 2007, 12:13 pm
Using Expect to spawn an interactive tool January 26, 2007, 4:10 pm
PAR problems Win32 (Can't Spawn, line 372) (solved) November 29, 2004, 9:55 pm
spawn and monitor multiple processes - report back when all have completed January 24, 2005, 2:11 pm
Looking for a module/program author, or help with program... September 7, 2005, 6:00 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap