At a certain part of my program, I call an error_check function to see if any errors have occured during some events. An example would be as follows:
@reducedProtein = initializeStructure ##some operations(\@residueArr +ay,\@secondaryStructureArray); if ($ERRORCHECK ==1) #if global errorcheck is 1 {$response = confirmExit(@ERRORTYPE);} #call error function if($response==1){ simulate(@reducedProtein);} #if not, go to calculations etc
Now the confirmExit is a function that calls a perlTK widget to create a window. It has two buttons. One is an exit button and exits the program if it is pressed. Other is an ignore button that returns a $response telling that the program can go on. My question is, how can I cause the program to stop until the user presses one of the buttons? I want it so that the program has to wait for the return value from the confirmExit to continue but I know perlTK works in a strange way. I think that it will just create the window with the buttons and return an empty value without waiting for the user to press a button. The skeleton of the confirmExit function is :
sub confirmExit { *create a window* my @ERRORTYPE=@_; *write something on the window according to errortype values* *create button exit, which exits the program when pressed* *create button ignore, which sets the value of $response to 0 if pres +sed* return $reponse;

In reply to Stopping the Program by Anonymous Monk

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.