Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I am trying to run this presentation (show.exe) from a browser by calling it from my Perl Script here, but something is not working. Can someone let me know if there is a better way to use perl to call an .exe file from a browser, or to show me what I a doing wrong here?
Thanks a lot!
#!c:/perl/bin/perl.exe -w use strict; use CGI; my $q = new CGI; print $q->header( "text/plain" ); system "cmd.exe /c show.exe";

Replies are listed 'Best First'.
Re: Call to an .exe file
by Cody Pendant (Prior) on Feb 08, 2006 at 00:37 UTC
    What does "show.exe" do? What does it output? You've sent the header for a plain-text page to the browser, then your system command, so, what are you expecting to happen at that point? You say it's a "presentation", which doesn't sound like plain text. I guess if your system call resulted in some output to STDOUT then your browser would show that output, but it sounds like you're expecting something completely different, like powerpoint?


    ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
    =~y~b-v~a-z~s; print
Re: Call to an .exe file
by GrandFather (Saint) on Feb 08, 2006 at 00:03 UTC

    What sort of not working?

    Do you need cmd.exe /c in the system call?

    Is show.exe on the path or is the current directory what you expect it to be?


    DWIM is Perl's answer to Gödel
Re: Call to an .exe file
by NetWallah (Canon) on Feb 08, 2006 at 00:32 UTC
    Are you expecting "show.exe" to run on the CLIENT (browser) or the web server ? I suspect you want it on the client. The proper way to do that would be to publish a link to the UNC path to the executable. That way, "show.exe" can reside on any server share, and be linked in from a web page. (All this presumes that this is on some local Intranet - this has some huge security implications).

         "For every complex problem, there is a simple answer ... and it is wrong." --H.L. Mencken

      If you decide to use this solution and use a UNC path, I beleive it would basically be specifying the UNC path in a URI, e.g.

      file:///servername-here/sharename-here
      keep in mind that UNC paths only work in IE, at least so far as I've tested. I have a site that I've had to do that, and found that it doesn't work in Firefox on Windows or Mac. I haven't tried other browsers, but I suppose you may be able to use Opera, but it may have to be IE compatibility mode.

      Also, you may have to use javascript to launch show.exe from the UNC path (this is assuming, again, that you want it on the client side).