Bind Module for Perl
- From: Jens Luedicke <jens luedicke gmail com>
- To: gtk-perl-list gnome org
- Subject: Bind Module for Perl
- Date: Fri, 31 Dec 2010 13:38:02 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey,
during the last few days I prepared a Bind module for
Perl which works in a similar way as Boost Bind:
http://search.cpan.org/~jensl/Class-Bind/
Example:
use Class::Bind;
$button->signal_connect(clicked => bind(\*MyWindow::callback, $self,
_1, _2, _3));
Bind returns an anonymous function that is used as the callback for
the clicked signal. The anonymous function itself calls
&MyWindow::callback($self, ...) and passes the first three arguments of
the anonymous function to the actual callback method.
_1, _2, _3 are placeholders for arguments. They will be replaced by
arguments passed to the anonymous function returned by bind().
Note: The globref that is required as the first argument to bind() will
be replaced by a coderef in version 0.3.
I made the module with signal-callback systems in mind.
Comments are welcome!
Jens
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNHc6qAAoJEPFZu/9GrBiLvCYIALG2/U/9At+4Esd3WstsXvlO
f/6kpQE2tM2PbqSAhFq+yshAAsjAFIyaBfGY2u0WByHXFjVoAANJheoY3isnrG9/
Jmrw/zK8YyZQHLW7PxrNZ/fn/sxVEkAS0nDp+vnDvXPDUDX+VWbEodw/pO6JmoZ2
2bRPpOQKUIY//HM5WczgoTsu3/r4nToJdoUwtwPpSGiGWfmPXNJbHeRXHcbTmVM2
Zc327BYkuMHyEvf/2xeMbo97h62C53RNJwhh0/byPxNMuhFqCkNuLgwBIDp7I0eQ
gOD33A/GBB2qd+kkKCZtDH4aLRuY0fdGPl31fcoNskDMgVw1t31ngSGVDxuRJ3M=
=yETG
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]