Re: Execute Windows program from Perl script (??)
From: Brian McCauley (nobull_at_mail.com)
Date: Sat, 28 Aug 2004 19:16:54 +0100
Tony McGuire wrote:
> email@example.com (Tony McGuire)
>>system( "start", "C:\Program Files\TextPad 4\TextPad.exe");
>>There is no error. The web page I post from just sits there as if the perl
>>were executing. And when I check the 'server' box I find a cmd.exe in Task
>>Mangler, one for each time I run the script.
>>And the only way to remove the 'hidden' copy of cmd.exe (there's no DOS box
>>up) is to reboot Windows. When I try to end task on them, I get 'Access
> I guess what I am looking for isn't doable from perl.
What in this thread makes you guess that?
> I was looking to start a Windows program independent of the Apache
Well that is a question about Windows - having worked what succession of
windows API calls was necessary to achive that effect you could then
make those calls from a program written in any lanuage that gives you
access to the low level Windows API. This would include Perl with the
relevant Win32::* modules intalled.
> But I doubt Apache will restart if there is a process running, which
> there would be if perl must wait on anything it starts with system().
There are other windows-specific ways to start processes from a Perl
script as I mentioned earler in this thread.
> Well, back to the drawing board. I guess I'll write to a file (with
> perl), and have a scheduler watch for the file to be changed - then
> kick off that other Windows program using the scheduler.
And there is, of course, no reason why that program can't be written in
Perl. Just like there's no reason why your CGIs can be written in C.
> That way the Windows program is running independently of
> Apache and the perl script.
I think you mean the CGI script. Yes it may be the case that your CGI
script is in Perl but the issues you are facing here would be the same
is you CGI script was written in C, Python, Java, FORTRAN etc.
> I was hoping to coordinate everything with just perl,
There is no reason why you should not.
> but it doesn't seem to be up to this particular task.
What causes you to imagine that?