After much googling I see that this is an issue that has been around for 
a very long time with no resolution. After a lot of messing around I 
found a workaround that I figured I would share. Take the following 
hello.pl program, taken from the Gtk2-Perl Study Guide.

use Gtk2 -init;
my $window = Gtk2::Window->new ('toplevel');
$window->signal_connect (delete_event => sub { Gtk2->main_quit });
my $button = Gtk2::Button->new ('Action');
$button->signal_connect (clicked => sub { print("Hello Gtk2-Perl\n"); });
$window->add ($button);
$window->show_all;
Gtk2->main;

perlapp hello.pl

hello.exe

this yields

GLib-GObject-CRITICAL **: g_object_steal_qdata: assertion `quark > 0' 
failed at hello.pl line 2.
GLib-GObject-CRITICAL **: g_object_set_qdata_full: assertion `quark > 0' 
failed at hello.pl line 2.
Can't locate object method "signal_connect" via package "Gtk2::Window" 
at hello.pl line 3.

Of course, this script works as expected by calling "perl hello.pl", but 
not as a perlapp packaged program

So, maybe there's some sort of intermediary step we can take to resolve 
the issue.

Adding the --dependent option is a thought, which brings: Can't locate 
Gtk2.pm
After resolving that by --add Gtk2, we get another dependency problem. 
After pushing through them all we have:

perlapp hello.pl --dependent --add Gtk2 --add strict --add warnings 
--add Glib --add Exporter --add constant --add warnings::register --add 
vars --add overload --add Carp --add Config --add AutoLoader --add 
Config_heavy.pl

We still run into the problem. However, we have another option at our 
disposal. --dyndll

perlapp hello.pl --dependent --add Gtk2 --add strict --add warnings 
--add Glib --add Exporter --add constant --add warnings::register --add 
vars --add overload --add Carp --add Config --add AutoLoader --add 
Config_heavy.pl --dyndll

Aha! It works! So...can we take away --dependent so that it's 
standalone? Yep!

perlapp hello.pl --add Gtk2 --add strict --add warnings --add Glib --add 
Exporter --add constant --add warnings::register --add vars --add 
overload --add Carp --add Config --add AutoLoader --add Config_heavy.pl 
--dyndll

Gives us a working, standalone hello world program!

So, the workaround is to systematically create a dependent executable, 
run it, see what's missing, add, rinse, repeat.

Is it a pain? Yep...but it works!

Oh, of course, don't forget the dlls that also need to be shipped.

T.J. Ferraro


_______________________________________________
gtk-perl-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to