Re: Execute Windows program from Perl script (??)

From: Brian McCauley (nobull_at_mail.com)
Date: 08/28/04


Date: Sat, 28 Aug 2004 19:16:54 +0100


Tony McGuire wrote:

> tony@paradoxcommunity.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
>>Denied'.
>
>
> 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
> umbrella.

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?



Relevant Pages

  • Re: file access trouble
    ... Tried your suggestion - did not make any difference - my script does not ... >> I am a new user to perl - trying to teach myself enough perl to do a ... >> I created another windows based program that creates the .htpasswd file ...
    (comp.lang.perl.misc)
  • [SLE] running CGI scripts written in notepad
    ... I'm currently learning CGI programming with perl and have built up a webserver ... I'm doing my development work on a windows ... If I write a perl script on my SuSE machine and put it in CGI bin, ... If I write a perl script on a windows machine, then copy it onto my Linux ...
    (SuSE)
  • 2005-10-23 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)
  • 2005-10-23 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)
  • 2005-11-20 [de.comp.lang.perl.cgi] FAQ
    ... Programmiersprache Perl in CGI-Scripten. ... Wo gibt es Dokumentation über Perl und CGI? ... Hilfe zum Programm perldoc kann man mit 'perldoc perldoc' ... Mein Script läuft nicht bei meinem Provider. ...
    (de.comp.lang.perl.cgi)