Stealing a good idea from Gtk#



Aloha,

have you ever seen the cool syntax the Gtk# people use for connecting
signals?  No?  Well, I have -- and I was jealous.  It looks like this:

  editable.Toggled += new EventHandler (OnEditableToggled);

Well, while brushing my teeth I had an idea.

One hour and fifty lines of Perl later, the attached Foo.pm was
finished.  Some sample usage:

  use Foo qw(Gtk2::Button Gtk2::Widget);

  $button -> Clicked += \&clicked;

  $window -> DeleteEvent += sub {
    Gtk2 -> main_quit();
    return FALSE;
  };

Cool, eh?  That looks even better than the Gtk# stuff.  I just love
Perl.

I used studly caps for the signal names because if you use the orignal
names you get collisions with existing methods like
Gtk2::Button::clicked.

Now I just need a name for this baby since "Foo" isn't all that
descriptive.  Any suggestions?

-- 
Bye,
-Torsten

Attachment: Foo.pm
Description: Perl program

Attachment: example.pl
Description: Perl program



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