Hello
I am new in Perl and CGI. I want to write a program in perl that enables me to call executables, some of them maybe GUI.
My starting point was to write a small program that would call an interface because this is on a local machine. Ultimately i want to send commands to execute applications from a client.
The program i wrote gives me this error
Can't spawn "cmd.exe": No such file or directory at C:/www/cgi-bin/compound.pl line 8. child exited with value 255. what do i do to make run all my applications?

The program is like <>

my $mouse = ("start /maximised /Program Files/DHI/MOUSE2002/Bin/Syrakus.exe");##"C:\Program Files\DHI\MOUSE 2002\Bin\Syrakus.exe" MOUSE2002_80
system $mouse ;
if ($? == -1) 
{ print "failed to execute: $!\n"; } 
elsif ($? & 127) 
{ printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; } 
else 
{ printf "child exited with value %d\n", $? >> 8; }

Recommended Answers

All 7 Replies

To run any system application with perl you use:

system()
backtiks: ` `
qx/ /
exec()

but exec exits the perl program. Whcih you use depends on what you are doing.

Am not sure that gives me the answer, it is like it either starts the application but nothing shows or because of the error it doesnt. I wanted to know how i can get the error solved and how i can run different applications remotely.
thanks


Hello
I am new in Perl and CGI. I want to write a program in perl that enables me to call executables, some of them maybe GUI.
My starting point was to write a small program that would call an interface because this is on a local machine. Ultimately i want to send commands to execute applications from a client.
The program i wrote gives me this error
Can't spawn "cmd.exe": No such file or directory at C:/www/cgi-bin/compound.pl line 8. child exited with value 255. what do i do to make run all my applications?

The program is like <>

my $mouse = ("start /maximised /Program Files/DHI/MOUSE2002/Bin/Syrakus.exe");##"C:\Program Files\DHI\MOUSE 2002\Bin\Syrakus.exe" MOUSE2002_80
system $mouse ;
if ($? == -1) 
{ print "failed to execute: $!\n"; } 
elsif ($? & 127) 
{ printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; } 
else 
{ printf "child exited with value %d\n", $? >> 8; }

I believe the error codes are specific to the operating system, so you may have to try and determine what 255 means for your operating system, personally I don't know. Maybe someone else can shed some light on this problem for you.

Thank you Kevin,
I can run the application using the different methods, system,backticks and open on commandline. When i run a windowcomes up as expected and executes the comands it however doesnt work on internet even on same computer. The window should be able to come up on server and not affect the execution is it?
Please assist am stuck.

#@args = ("/Program Files/DHI/MOUSE 2002/Bin/mouse604.exe", '\MOUSE\Tutor1.mpr', "Ro", "Run", "Close", "NoPrompt","Minimize");
#@args1 =("/Program Files/DHI/MOUSE 2002/Bin/mouse604.exe", '\MOUSE\Tutor1.mpr', "HD" ,"Run", "Close", "NoPrompt","Minimize");
#system (@args)==0 or die "system failed at: $?";
#system (@args1)==0 or die "system failed at: $?";
$mouse = ("/www/cgi-bin/mouse.bat");
local *PIPE;
open (PIPE,"$mouse |")or die "Can not open pipe";
print while <PIPE>;
close PIPE;
#system $mouse ;
#@output=`@args`;
#@output=`@args1`;

You may want to post on another forum where there could be more members that have experience with this type of thing you are trying. Try perlmonks or devshed.

I relation to this subject i want to pass a parameter (Name) from a form and use it in subsequent execution execution of this perl program. how do i do that.
Is it possible to call a GUI remotely?

please start a new thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.