Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running external program from CGI/Perl

Status
Not open for further replies.

elsanto666

Programmer
Aug 11, 2008
2
BE
Hi all,

I'm from Java and new to perl. I'd like to call from computer A a program on computer B, so to avoid any firewall or network settings, I decided to use port 80 and have an Apache server sitting on computer B that will get an HTTP request from A and run the program.
So I started learning cgi scripting with Perl and I can get computer A to call basic commands on computer B like "dir" ...
But when I do something more complex, like calling a prog.exe, the web page hangs, the prog.exe process is visible in the computer B task manager and nothing happens.
Any advise is welcome
Thanks a lot
 
Hey, we should think up a name for this. How about 'web service'? [smile]

But seriously, how are you 'calling' the program from your CGI script - post some code and we'll have a look at it...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
I think we can probably lose the BAT file, as it may be spawning a command window which may be the source of the hang. Something along the lines of
Perl:
my @command_output = qx{C:/Program Files/TTB/ttb.exe};
might do it, although you may need to mess about quoting the path to the command because of the space in Program Files. Sorry I'm on Linux just now so can't test this properly...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top