use strict; use warnings; use Gtk2 '-init'; my $toplevel = Gtk2::Window->new('toplevel'); $toplevel->signal_connect (destroy => sub { Gtk2->main_quit }); my $button = Gtk2::LinkButton->new_with_label ('http:://foo.bar', 'Press me'); $toplevel->add ($button); Gtk2::LinkButton->set_uri_hook (\&first_func, ['fsdjkljsdfkl']); sub first_func { print "userdata: ",$_[2],"\n"; Gtk2::LinkButton->set_uri_hook (undef, undef); print "userdata: ",$_[2],"\n"; } $toplevel->show_all; Gtk2->main; exit 0;