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

Re^2: Die vs. Exit

by zentara (Archbishop)
on Jul 20, 2012 at 21:03 UTC ( [id://982906]=note: print w/replies, xml ) Need Help??


in reply to Re: Die vs. Exit
in thread Die vs. Exit

This little bit of code might help. In the bigger picture, you probably shouldn't be calling die or exit, just to catch bad user input, use validation rountines on Entrys, etc.
#!/usr/bin/perl use warnings; use strict; use Tk; require Tk::ErrorDialog; my $mw = new MainWindow; $mw->title("Close test"); $mw->geometry("400x250"); #prevents mw from closing $mw->protocol('WM_DELETE_WINDOW' => \&save_it ); $mw->after(2000, sub{ die } ); MainLoop; sub save_it { print "do stuff here before the exit\n"; $mw->messageBox(-message=>"you tried to exit!"); }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://982906]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-26 03:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found