I'm new to Perl/Tk and have what I hope are a couple of basic questions about handling window exits. Actually this first one is probably more of a basic perl question...

1. I have a script that envokes a second Perl/Tk script to get some input from the user. The second is standalone because it's general purpose and I didn't want to rewrite it every place I want to use it. Anyhoo, I'm running this second script through a system call:

system("perl path_to_other_script");

If a user decides to exit while in that second script (which is a child process in my mind), how can I tell the parent to exit as well? And can I tell the difference between a user-selected exit versus the script running its course successfully?

2. In each of my Perl/Tk scripts I include a button or a menu option that issues an 'exit' so I can force whatever the script is doing to stop. Works great as long as a user doesn't hit the 'x' in the upper right hand corner of the window. Is there a way to catch that 'x' signal? I've tried creating signal handlers for INT, ABRT, KILL, STOP, and QUIT, but none of them seem to apply.

Any help would be GREATLY appreciated!!


In reply to Handling child process and close window exits in Perl/Tk by meliason

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.