Re: more on perl5 modules
I copied your neat program into a file, called it gtk2test.p6 and got pugs gtk2_test.p6 *** unexpected : expecting term postfix, operator, ; or end of input at gtk2_test.p6 line 2, column 56 However, I am using pugs from the debian package and not directly from the repository. So perhaps, the problem is I am not using the latest version of pugs. Regards, Richard A. Pagaltzis wrote: * Richard Hainsworth [EMAIL PROTECTED] [2006-09-17 18:05]: The .can workaround doesnt seem to work for more complex modules. Err, the .can workaround is a way to get past missing sub exports. Methods are never exported. Why are you using the workaround for sub exports on methods. Here is a working perl5 program that puts up a message with two buttons. use strict; use Gtk2 -init; use Gtk2::Ex::Dialogs(destroy_with_parent=-1, modal=-1, no_separator = 0); my $window = Gtk2::Window-new('toplevel'); Gtk2::Ex::Dialogs-set_parent_window( $window ); my $r = Gtk2::Ex::Dialogs::Question-ask( Is Perl only hackers glue?); if ($r) {print yes\n;} else {print no\n;}; Should be simply: use perl5:Gtk2 '-init'; use perl5:Gtk2::Ex::Dialogs :destroy_with_parent( -1 ) :modal( -1 ) :!no_separator; my $window = Gtk2::Window.new( 'toplevel' ); Gtk2::Ex::Dialogs.set_parent_window( $window ); my $r = Gtk2::Ex::Dialogs::Question.ask( Is Perl only hackers glue? ); say $r ?? 'yes' !! 'no'; Regards,
Re: more on perl5 modules
* Richard Hainsworth [EMAIL PROTECTED] [2006-09-18 15:20]: I copied your neat program into a file, called it gtk2test.p6 and got pugs gtk2_test.p6 *** unexpected : expecting term postfix, operator, ; or end of input at gtk2_test.p6 line 2, column 56 Note my translation was purely based on what I picked up, and completely untested. Debug as needed to fix it. Regards, -- Aristotle Pagaltzis // http://plasmasturm.org/
more on perl5 modules
The .can workaround doesnt seem to work for more complex modules. Here is a working perl5 program that puts up a message with two buttons. use strict; use Gtk2 -init; use Gtk2::Ex::Dialogs(destroy_with_parent=-1, modal=-1, no_separator = 0); my $window = Gtk2::Window-new('toplevel'); Gtk2::Ex::Dialogs-set_parent_window( $window ); my $r = Gtk2::Ex::Dialogs::Question-ask( Is Perl only hackers glue?); if ($r) {print yes\n;} else {print no\n;}; Here is an attempt to do the same in perl6 use v6; use perl5:Gtk2 -init; say called Gtk3 init; my $window = initialise(); say window initialised; use perl5:Gtk2::Ex::Dialogs(destroy_with_parent=-1, modal=-1, no_separator = 0); our gsetparent := Gtk2::Ex::Dialogs.can('set_parent_window'); say Now trying to use the window; gsetparent( $window ); our ask := Gtk2::Ex::Dialogs::Question.can('ask'); my $r = ask( Is Perl only hackers glue?); if ($r) {say yes;} else {say no;}; sub initialise () { # I took this eval(uation) of perl5 by pugs from one of the examples in the pugs distribution eval (q! my $win = Gtk2::Window-new('toplevel'); $win; !,:langperl5); }; Here is the output $ pugs ./gtk2_test.p6 called Gtk3 init window initialised Now trying to use the window Undefined subroutine main:: called. I tried a variety of coding techniques. None seems to work. eg., our gwin := Gtk2::Window.can('new'); our gwin := Gtk2.can('Window-new'); our gwin := Gtk2.can('Window.new'); The problem seems to be that Gtk2::Window does not exist as a separate module, viz., there is no Window.pm in the Gtk2 directory space. Any ideas?
Re: more on perl5 modules
* Richard Hainsworth [EMAIL PROTECTED] [2006-09-17 18:05]: The .can workaround doesnt seem to work for more complex modules. Err, the .can workaround is a way to get past missing sub exports. Methods are never exported. Why are you using the workaround for sub exports on methods. Here is a working perl5 program that puts up a message with two buttons. use strict; use Gtk2 -init; use Gtk2::Ex::Dialogs(destroy_with_parent=-1, modal=-1, no_separator = 0); my $window = Gtk2::Window-new('toplevel'); Gtk2::Ex::Dialogs-set_parent_window( $window ); my $r = Gtk2::Ex::Dialogs::Question-ask( Is Perl only hackers glue?); if ($r) {print yes\n;} else {print no\n;}; Should be simply: use perl5:Gtk2 '-init'; use perl5:Gtk2::Ex::Dialogs :destroy_with_parent( -1 ) :modal( -1 ) :!no_separator; my $window = Gtk2::Window.new( 'toplevel' ); Gtk2::Ex::Dialogs.set_parent_window( $window ); my $r = Gtk2::Ex::Dialogs::Question.ask( Is Perl only hackers glue? ); say $r ?? 'yes' !! 'no'; Regards, -- #Aristotle *AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1}; Just-another-Perl-hacker;