Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^5: Inotify2 + AnyEvent (naked code ref)

by zentara (Archbishop)
on Oct 06, 2011 at 10:06 UTC ( #929965=note: print w/replies, xml ) Need Help??

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

I'm not going to install Tk at the moment.

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__

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

Replies are listed 'Best First'.
Re^6: Inotify2 + AnyEvent (naked code ref)
by Anonymous Monk on Oct 06, 2011 at 10:12 UTC
    $ perl -MO=Deparse -e " $foo = \&bar " $foo = \&bar; -e syntax OK $ perl -MO=Deparse -e " $foo = \&bar() " $foo = \(&bar()); -e syntax OK

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2016-10-27 06:33 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (353 votes). Check out past polls.