Hopefully this will help...
 
I had a similar problem with system() on W2K (with IIS 4), where I waited to catch a return but nothing happened, but from a command line it seemed workable.  I ended up using backticks instead.  I also had to put my actual command into a variable because the command line input expects quotes throughout, and it was just too painful otherwise (nothing worked).  Here's the subroutine, so you can gauge the context.  Everything started working after I made the change.
 

sub OpenRequest {

    UpdateUserInfo();

    print PERLLOG "$now: starting OpenRequest...\n";

    $frg_cmd = "bop_cmd -f e:\\caisd\\site\\mods\\majic\\web_cust_make_request.frg";

    $log_agent = "1852";

    $frg_string = "\"make_request($log_agent, $rd_id, '', 0, 0, 0, '$summary', '$prob_description', '')\"";

    # tried the system call first but was getting back funkiness

    # backtick method - supported on both Win* and *nix platforms - made it do my bidding

    $new_req_id = `$frg_cmd $frg_string` or die "$now: unable to process frg file due to backtick failure : $?";

    print PERLLOG "$now: $frg_cmd $frg_string \n";

    print PERLLOG "$now: created req with persid $new_req_id";

    FetchReqNum();

    Ending();

    return;

}

exit;

-----Original Message-----
From: Forward Design [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 4:32 PM
To: [EMAIL PROTECTED]
Subject: System Command Hangs Perl

I have Windows 2000, latest Apache installed for Windows, and latest Active Perl installed.
 
I am very new to this, but this is what I can already do and have working:
 
I can access a webpage that I placed in the htdocs folder from my IP address.
 
I can run a simple perl script.
 
Here is what I want to do:
 
I want to have a webpage, when a user clicks on a button, it runs a perl script
 
on my server (my machine), that then runs a Windows program on the server, which
 
spits out a file, that the user can then download.
 
No, I am not trying for the user to see the GUI of the windows program.
 
The windows program, will eventually have no interface, just run, do its work, and exit.
 
My problem is this, I have an HTML page with a button, that calls my perl script.
 
The perl script is using the command:
 
system('d:\myprog.exe');
 
When that command is executed, my machine just sits there.
 
I see that 'myprog.exe' is listed in the Task Manager, but I cannot end that process, permission denied.
 
I can type into a dos window 'perl myperlscript.pl', which contains the system
 
command above, and sure enough, my program pops up (right now, the windows
 
program does have a GUI).
 
The GUI is not a problem, I have tried this, and others, something simple, and it still hangs:
 
system('delete d:\crap.txt');
 
The Apache error logs never gets filled in, because the script never stops, it hangs.
 
What am I doing wrong?
 
I know this must be a stupid problem/answer, but I need help.
 
How does one have a perl script, called from an HTML page, run a windows exe?
 
Right now it hangs!
 
Thanks in advance...

Scott Thede

EML: [EMAIL PROTECTED]


******************************************************************
This email and any files transmitted with it from the ElPaso
Corporation are confidential and intended solely for the
use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the
sender.
******************************************************************

Reply via email to