http://www.perlmonks.org?node_id=929880


in reply to Re^3: Inotify2 + AnyEvent (naked code ref)
in thread Inotify2 + AnyEvent

I'm not going to install Tk at the moment. But, \&callback does not call callback() (it just provides a code ref):

$ perl -le 'sub callback { die "called( @_ )!" } print \&callback' CODE(0x219b4c0) $ perl -le 'sub callback { die "called( @_ )!" } print \&callback("ar +g")' called( arg )! at -e line 1. $

The Tk::Button documentation (see also Tk::callbacks) implies that -command => $codeRef will not immediately call the referenced sub.

There certainly could be other reasons for that usage to cause "pre-mature exit and crash". For example, -command => \&callback, time, would likely "crash".

I see plenty of evidence to suggest that it will not cause callback() to be called at button-creation time and no details suggesting that you have enough evidence to support that one part of your claim.

- tye