Ok, thanks for explaining. It's the () that causes premature exiting.
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->geometry("400x200"); my $button = $mw->Button(-text => "Sub test exit", -command => \&callback(), # exits prematurely # -command => \&callback, # works ok )->pack(); MainLoop; sub callback{ print "exiting\n"; Tk::exit; } __END__
In reply to Re^5: Inotify2 + AnyEvent (naked code ref)
by zentara
in thread Inotify2 + AnyEvent
by dlal66
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |