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

When I run a script from within another application that supports Perl then the application will be locked until the script has finished. Is it possible in Perl to build in a Pause with a TK gui that allows interacation (unlock the application) with the application until the operator tell the script to continue. (I have been checking google but only could find sleep which only delay the script but doesn not allow interaction)

Replies are listed 'Best First'.
Re: Pause a perl script
by Gloom (Monk) on Jan 25, 2001 at 14:00 UTC
    You can use sleep without argument. In this case, the script hang until it receive a SIGALARM signal ( from another app of course ).

    I hope this help ( and that I haven't missunderstood the question :)
Re: Pause a perl script
by ichimunki (Priest) on Jan 25, 2001 at 18:01 UTC
    A program/process/thread can only be doing one thing at a time unless you fork the process or start a new thread. If the program thinks it is running a Tk program then it will have to wait for the Tk program to finish. It sounds like a case for fork and using something like a pipe for interprocess communication (or you could have your initial application periodically check for some other signal that the Tk script has done what it needs to do).
Re: Pause a perl script
by AgentM (Curate) on Jan 25, 2001 at 20:02 UTC
    You could use signals with a sleep (mentioned above- that seems harmless enough) or you give IPC a try which will allow you to pass relevant information ALONG with the signal to continue. Maybe then, you can be sure that the SIGARLM is really a continue and not a joke played on you by a mindless "other" root user.
    AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
Re: Pause a perl script
by locked_user mr_leisure (Beadle) on Jan 25, 2001 at 14:59 UTC
    You can have a look at Main::Fileevent in Tk. Its pretty handy for looping, sleeping etc.
    Do a googlesearch for Fileevent + Tk, or check out page 305 of Learning Perl/Tk from O'Reilly.

    Also Known As : Captain Contraption
    if ($mr_leisure) { bow; }
    this is still not finished