How to emit signals in Glib::Object derived modules?


I am trying to implement a module derived from Glib::Object. This
works fine, except for when I want the module to emit a self-defined

I know from the Gtk-Perl documentation that new signals have to be
registered first. So this is what I expected to work:

#!/usr/bin/env perl
package TestClass;
use strict;
use Gtk2 '-init';
use vars qw(@ISA $VERSION);
@ISA = qw(Glib::Object);

$VERSION = 0.01;

use Glib::Object::Subclass
    signals => {
      my_new_signal => {
        class_closure => sub { print "BLA\n" },
        flags         => [qw(run-first)],
        return_type   => undef,
        param_types   => []

sub new {

Unfortunately, this produces an error message:

Uncaught exception from user code:
        package TestClass has not been registered with
GPerl at /usr/lib/perl5/Glib/Object/ line 225.
BEGIN failed--compilation aborted at ./ line 11.

Google was not helpful. I'm clueless.

Any hints?

"A mind is a terrible thing to have leaking out your ears." -- The
League of Sadistic Telepaths

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