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

Hi, How do you set the exit code when calling the $mw->destory method?

I want to return an exit code of 2 so the calling program can do some stuff.

The destroy method always returns 0 and I get errors when trying to use exit(2).

Any ideas?

Thanks!

  • Comment on setting the exit code for Perl/Tk Apps?

Replies are listed 'Best First'.
Re: setting the exit code for Perl/Tk Apps?
by starX (Chaplain) on Feb 08, 2008 at 19:29 UTC
    Been a little while since I've had to do anything in Tk, but IIRC, you need to call exit after $mw->destroy.
Re: setting the exit code for Perl/Tk Apps?
by zentara (Cardinal) on Feb 08, 2008 at 19:59 UTC
    Read "perldoc Tk::exit", it explains the return code. Basically use Tk::exit(2) instead of plain old exit.

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      Thanks, I'll look into this module!
Re: setting the exit code for Perl/Tk Apps?
by kyle (Abbot) on Feb 08, 2008 at 19:22 UTC

    What's the error you get when you call exit directly?