Re: Stealing a good idea from Gtk#

On Sun, 2004-09-26 at 21:45, muppet wrote:
On Sep 26, 2004, at 8:00 PM, A. Pagaltzis wrote:

* Torsten Schoenfeld <kaffeetisch gmx de> [2004-09-26 23:45]:
  $button -> Clicked += \&clicked;

[snip, with total agreement]

As far as a) is concerned, the really Perlish way would of course
be a tied array that you can push subrefs onto and delete from...
but ehm, that would be overengineered. :)

(and, actually, impossible.  you can find out if there are handlers 
connected, and you can block and disconnect, but you can't *list* the 
handlers of a signal on a given instance.)

No, but couldn't you store the connection id in the array, and use that
as the means for "listing" and disconnecting.  Is it a problem if you
only keep track of the handlers you've installed via this method?

If you're looking for syntactic sugar, there's all kinds of ways.  For

use Gtk2::Ex::Signal qw/connect connect_after disconnect/

my $id = connect($window, delete_event, \&my_delete);
my $did = connect_after($dialog, delete_event, sub{ do_whatever; });

Then again, what are you really saving here, it's still about the same
amount of typing.

But I still like the tied array idea the best.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]