Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2017-11-24 17:13 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (351 votes). Check out past polls.