On 10.04.2016 20:48, Jeremy Volkening wrote:
> A few months ago I updated the Poppler module to use
> Glib::Object::Introspection to generate the bindings. I just realized
> yesterday that this broke the "new_from_data()" constructor. I realized
> this as I was wrapping librsvg 2.0 in a similar fashion
> (https://github.com/jvolkening/p5-Image-Rsvg) and came across the
> problem of passing in a Perl scalar when the underlying library wanted
> a char array pointer.

Since new_from_data is currently not annotated to take an array of
bytes, a normal string should work fine in Perl.  This works for me:

---
use Glib::Object::Introspection;
BEGIN {
  Glib::Object::Introspection->setup (
    basename => 'Poppler',
    version => '0.18',
    package => 'Poppler');
}

my $f = 'some PDF file';
open my $fh, '<:raw', $f or die "Could not open $f: $!";
my $data; { undef $/; $data = <$fh> };
close $fh;

warn my $d = Poppler::Document->new_from_data ($data, length $data);
---

Does it not work for you?
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to