Hi Max,

On Fri, May 6, 2016 at 12:10 PM, <max.augsb...@gmx.de> wrote:

> Sorry if the questions are too easy but it is my first attempt to write a
> GTK3 binding with GOI.
>

Actually both problems are not  GOI related, it's just Perl:


> Using the modul I noticed two problems:
> 1) If I write *"my $lm =
> Gtk3::SourceView::LanguageManager->get_default();"* I get the warn: "***
> Gtk3::SourceView::LanguageManager::get_default: passed too many parameters
> (expected 0, got 1); ignoring excess at test.pl line 22." Surprisingly *"my
> $lm = Gtk3::SourceView::LanguageManager::get_default();"* works without
> problems.
>

Do not *invoke a method* when you actually want to *call a function.*

module_name->function_name() is the same as
module_name::function_name('module_name'):
https://metacpan.org/pod/distribution/perl/pod/perlobj.pod#Method-Invocation


> 2) If I set the language with  *"my $lang = $lm->get_language("perl");"* and
> set the buffer with "*$buffer1->set_language("$lang");"* I get the error
> "`Gtk3::SourceView::La...' is not of type Gtk3::SourceView::Language
>

Your extraneous quotes say that you're *not* calling set_language with $lang,
but with *another* value representing $lang's *stringification*.
https://metacpan.org/pod/distribution/perlfaq/lib/perlglossary.pod#stringification

+ one more issue:

*our $VERSION = "0.01";*
> *sub import {*
>
>
>
> *    Glib::Object::Introspection->setup(        basename => "GtkSource",
>      version => "3.0",        package => "Gtk3::SourceView",*
>

Please do not use *interpolating* quotes needlessly:
https://metacpan.org/pod/distribution/perl/pod/perlop.pod#Quote-and-Quote-like-Operators

Good luck!
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to