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




Samuel Abels said:
Unfortunately I am trying to implement this for a Perl
program that loads the module as a plugin only under certain conditions,
so it happens at runtime. So in this case, it produces this error
message:

Too late to run ??? block
        (W void) A CHECK or INIT block is being defined during run time
        proper, when the opportunity to run them has already passed.
        Perhaps you are loading a file with "require" or "do" when you
        should be using "use" instead. Or perhaps you should put the
        "require" or "do" inside a BEGIN block.

Any chance to make this work at runtime? Ugh, just saw that it is
possible to define the block type somehow. I'll give it a shot when I
get back to work tomorrow. ;)

there are two ways:

a) upgrade to Glib 1.060  (due out in the next week or so; use 1.055 until
then.  This fix is one of the main new features in 1.06x.)

b) call Glib::Type::register_object() directly instead of "use"ing the
Glib::Object::Subclass module, which is basically just a wrapper around the
function.


both options remove the CHECK block problem, but b), which requires more
effort, will work even on 1.04x.  you'll have to supply your own
GET_PROPERTY(), SET_PROPERTY(), and new() functions.  see the docs for
Glib::Type::register_obect() in the Glib::Type manpage.

-- 
muppet <scott at asofyet dot org>



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