in reply to Inotify2 + AnyEvent
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; $mw->geometry("400x200"); my $button = $mw->Button(-text => "Sub test exit", # this naked coderef is incorrect, as it causes # the callback to be executed at button creation # time, instead of later at button press -command => \&callback(time), # below is correct method, put [] around coderef # -command => [ \&callback, time ], )->pack(); MainLoop; sub callback{ my $in = shift; print "$in exiting\n"; Tk::exit; } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Inotify2 + AnyEvent (naked code ref)
by tye (Sage) on Oct 05, 2011 at 16:08 UTC | |
by zentara (Cardinal) on Oct 05, 2011 at 20:31 UTC | |
by tye (Sage) on Oct 05, 2011 at 21:05 UTC | |
by zentara (Cardinal) on Oct 06, 2011 at 10:06 UTC | |
by Anonymous Monk on Oct 06, 2011 at 10:12 UTC |