You can also use the start DOS command: system("START \"Re-executing...\" $0 $arguments"); exit;
you could then indicate the the current state of your program in args (or in a file) for the new one to resume its execution. Thomas ----- Original Message ----- From: "Dax T. Games" <[EMAIL PROTECTED]> To: "Perl Users" <[EMAIL PROTECTED]> Sent: Tuesday, February 18, 2003 4:04 PM Subject: Re: re-executing a program > That works on Windows and is very useful in certain situations. Why isn't > it documented anywhere? What are the drawbacks/side effects? > > I was writing a script last week that needed to launch 2 Windows executable > then exit. I couldn't use system() or exec() for various reasons. > > I tried using fork() but got unpredictable results. Unless you know another > way to do it. > > I resorted to using the 'start.exe' that comes with 2000 to achieve the same > effect as system(1,'command line'). It works but I don't like relying on > outside means if it is possible in Perl. > > Dax > ----- Original Message ----- > From: "Jan Dubois" <[EMAIL PROTECTED]> > To: "Dax T. Games" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, February 17, 2003 11:44 PM > Subject: Re: re-executing a program > > > > On Mon, 17 Feb 2003 22:04:43 -0500, "Dax T. Games" <[EMAIL PROTECTED]> > > wrote: > > > > >Simple. > > > > > >Create a new script with the following contents: > > > > > >exec("\"c:\\program files\\internet explorer\\iexplore.exe\""); > > > > > >Compile with -gui. > > > > > >exec pops up a command window when launched that stays open till IE is > > >closed. > > > > Ah, I see. It is only a problem for GUI programs. Note that wperl has > > the same problem as a perlappified --gui application, so I consider the > > behavior of PerlApp to be correct. > > > > If you don't tell anyone, I can show you a gross hack to make it work: > > > > system(1, 'c:\program files\internet explorer\iexplore.exe'); > > exit; > > > > The 1 must be a number, not a string! It will tell system() to invoke the > > command asynchronously and not to wait. It still inherits file handles, > > which may or may not be what you want. > > > > I'm too lazy right now to check if this would work on Unix too, but I > > doubt it. This hack was added to Perl ages ago for OS/2 use, and the > > Windows port supports it too. > > > > Cheers, > > -Jan > > > > _______________________________________________ > > Perl-Win32-Users mailing list > > [EMAIL PROTECTED] > > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs