Re: gtk-gtk2 migration problems...
- From: "Ross McFarland" <rwmcfa1 neces com>
- To: bboett adlp org
- Cc: gtk-perl-list gnome org
- Subject: Re: gtk-gtk2 migration problems...
- Date: Wed, 8 Oct 2003 16:04:30 -0400 (EDT)
Bruno Boettcher said:
i put the script i am actually working on onto
http://www.inforezo.org/~bboett/gtk2GUI
on running the script gives me:
Odd number of elements in anonymous hash at ./gtk2GUI.pl line 306.
'Load' => {
callback => ui_load($kernel),
#callback_action => 1,
},
the call back has to be a reference to a sub-routine or one that is defined
inline. you have callback being set to the return value of a subroutine call.
all of the callbacks in that section need to be something like:
the ulgy way, but maybe a little simplier, there are some issues here that
have to do with perl scoping and references, take a look at man perlref and
the other related man pages, they're essential knowledge for any perl
programmer:
callback => sub { un_load($kernel); },
the better solution is to provide the $kernel and $heap parameters as user
data. so each call back would be "callback => \&un_load," etc. and you would
have
my $menu = Gtk2::SimpleMenu->new (
menu_tree => \ menu_tree,
user_data => [ $kernel, $heap ],
);
un_load would then have have as it's first paramert a two element array ref.
see the problem below is closely related to the user data stuff mentioned
here. take a look at the faq entry about user data pointed to below.
*** unhandled exception in callback:
*** Usage: signal_connect(instance, detailed_signal, callback,
data=NULL) at ./gtk2GUI.pl line 748.
*** ignoring at /usr/local/share/perl/5.8.0/POE/Loop/Gtk2.pm line
285.
the second error at line 748 is becuase you're passing two user data varaibles
where only one is accepted. there's a entry in the faq about it,
http://gtk2-perl.sourceforge.net/faq/#15
-rm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]