RE: [gtk-list] Tutorial code converted to Perl
- From: tile primenet com
- To: gtk-list redhat com
- Subject: RE: [gtk-list] Tutorial code converted to Perl
- Date: Wed, 15 Apr 1998 19:30:35 -0000 (???)
On 16-Apr-98 Jason L Tibbitts III wrote:
> While I'm at it, what's the cleanest way to represent this:
>
> gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
> GTK_SIGNAL_FUNC (gtk_main_quit),
> GTK_OBJECT (window));
> ? I'm using:
>
> $button->signal_connect(clicked => sub {Gtk::main_quit($window)});
>
> but it's not really pretty and I'm not sure that it's doing the right
> thing. Is there an equivalent to signal_connect_object that doesn't use a
> coderef?
>
> - J<
There are two options... a more succint and simple one...
$button->signal_connect (clicked => \&Gtk::main_quit);
or the easily readable, pretty option
$button->signal_connect (clicked => sub { Gtk->main_quit });
Note that you do not need to send the $window object to Gtk::main_quit to
destroy the window gracefully. Neither produce errors and the script runs
under strict and -w with no errors.
--
tile
tile@primenet.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]