in reply to Re^4: Inotify2 + AnyEvent (naked code ref)
in thread Inotify2 + AnyEvent
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__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Inotify2 + AnyEvent (naked code ref)
by Anonymous Monk on Oct 06, 2011 at 10:12 UTC |