Re: Announcing: Perl bindings for LibSoup



On Wed, May 25, 2011 at 00:14, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
On 24.05.2011 22:54, Emmanuel Rodriguez wrote:

Thanks, it works with the most recent version that's in git.

Good to hear.

Is it possible to mix Introspection bindings with perl module that has
hand made bindings?

Good question. ÂAs you mention, the problem will be the lack of typemaps and
converter macros. ÂBut Glib::Object::Introspection uses the normal Glib
mechanisms to convert objects to and from Perl land. ÂSo I think the easiest
way would indeed be to add libsoup typemaps to your XS module (simply put
corresponding entries into your 'maps' file).
Adding the type libsoup maps into the webkit bindings works as expected.

What also works, at least if GObject types are involved, is to
substitute the original object by a GObject in the XS signature. If
the library using introspection is loaded the glib introspection will
be used to construct the right instances. This is a poor man's hack
and I doubt that it will work with boxed types.


But since WebKit also supports gobject-introspection, why not use it that
way as well? ÂIt's still a little rough around the edges, but here's your
browser.pl example ported to use the introspection stuff.

The introspection framework really looks nice. Your examples show that
it's very easy to write the bindings for arbitrary C C libraries quite
easily. What's the catch?  ;) Are there bugs or unimplemented parts?
This is too nice to be true.

Is there a way to provide custom made XS methods to an introspection
perl package? For instance, SoupMessageBody is defined as:

typedef struct {
        const char *data;
        goffset     length;
} SoupMessageBody;

And provides no accessor for data or length. Is there a way to
complete the introspection binding with extra XS methods?
If so do you know of an existing cpan package that does this?

-- 
Emmanuel Rodriguez



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