Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Waiting For Input

by Anonymous Monk
on Mar 04, 2013 at 08:20 UTC ( #1021597=note: print w/ replies, xml ) Need Help??


in reply to Re: Waiting For Input
in thread Waiting For Input

No Temp.pl does not need any input nor any pause. Rather the main scipt conatins this:

use Win32::Process; use Win32; sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } Win32::Process::Create($ProcessObj, "C:\\Perl\\bin\\perl.exe", "perl Temp.pl", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); $state = 1; while( <STDIN> ) { if( $state ) { $$ProcessObj->Suspend(); $state = 0; } else { $$ProcessObj->Resume(); $state = 1; } }

How do i end both the scripts? i think it is the main script that keeps on waiting..


Comment on Re^2: Waiting For Input
Download Code
Re^3: Waiting For Input
by Corion (Pope) on Mar 04, 2013 at 08:34 UTC

    So, when does the loop end?

    while( <STDIN> ) { ... }

    Maybe you want to print out some diagnostics at the end of Temp.pl and in your main script, to learn when a program starts or finishes, and when a program waits for input.

      The Temp.pl script gives me the last print statement conatined in it . So I know that the Temp.pl ends, But How do i tell this while loop to end? <\p>

        Why did you write that loop in the first place?

        On Windows, you end input to STDIN by entering CTRL+Z on an empty line and pressing enter.

        You may be correct, but the statement that you see the last print does NOT offer any assurances that Temp.pl actually ends: all you know for sure based on what you've told us is that Temp.pl runs thru the last print statement.

        Is "the last print statement contained in it" the very last code in the script?

        As to your question about how to end the while loop: you haven't shown us the code. Guessing on a fix for unknown code is not worth our time or yours.


        If you didn't program your executable by toggling in binary, it wasn't really programming!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021597]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-09-21 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls