Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Signal Capturing....

by venky4289 (Novice)
on Jul 08, 2013 at 06:29 UTC ( #1043043=perlquestion: print w/replies, xml ) Need Help??
venky4289 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have a TCL and PERL script, which i need to start the PERL script from TCL script and i need to stop the perl script whenever TCL script sends a interrupt signal to PERL script.

I am new to PERL script, Can anyone help me to know how to trap a signal in perl and how to send a signal from TCL script to PERL script. Thanks in Advance.

Replies are listed 'Best First'.
Re: Signal Capturing....
by BrowserUk (Pope) on Jul 08, 2013 at 14:33 UTC

    Once you've started your Perl script from Tcl, all you need to do is send it any one of several signals -- including, but not limited to SIGBREAK SIGINT SIGQUIT SIGTERM -- that will cause it to die immediately*.

    So, now all you need to know is how to send signals from Tcl -- which is a question for a Tcl forum not a Perl forum.

    (*Unless the author of the Perl script has decided to trap that signal.)

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Signal Capturing....
by Anonymous Monk on Jul 08, 2013 at 07:43 UTC
Re: Signal Capturing....
by sundialsvc4 (Abbot) on Jul 08, 2013 at 14:19 UTC

    Definitely do a “Super Search” on this one, because it is a frequently asked question.   There are at least three aspects to this FAQ:

    1. How to go about receiving the signal, especially in Perl’s version of multi-threading.
    2. How to cause the program to stop, not “in its trac...” but, “at an appropriate stopping-point, as soon as possible.”  
    3. How to efficiently wait for the signal to resume.
    ... and ... heh ... how to do that and debug that without losing your remaining hair in the process.

    Start searching here.

      1. How will searching Perlmonks find a solution to a Tcl question?
      2. WTF has that got to do with "Perl’s version of multi-threading"?

        If type ^C or ^break on any of my threaded perl scripts, they abort immediately just like any non-threaded script.

      You'll be familiar with the abbreviation GIGO; with you its more GOGOGOGOGOGO....

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1043043]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2018-06-23 09:28 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.