Hi!

On Freitag, 20. Mai 2016 13:16:59 CEST Jason McVeigh wrote:
> How do I create a VTK object from Perl using Inline::Python?
> 
> I am using the Visualization Toolkit (http://vtk.org) for 3D visualizations.
>  I had hoped to use Perl to call the Python bindings for VTK.  I have some
> example code below, however, I get a segmentation fault due to something
> wrong.
> 
>         my $o = \py_call_function("vtk","vtkPoints", @_);
>         my $p = [0,0,0];
>         bless $o, 'vtk::vtkPoints';
>         {
>             no strict 'refs';
>             push @{ "vtk::vtkPoints::ISA" }, 'Inline::Python::Object';
>         }

This looks like very low level trickery. Have you tried the high level 
interface?

use common::sense;
use Inline 'Python';

package Foo::Bar {
    use base qw(Foo);
}

say Foo::Bar->new->bar;

__END__
__Python__

class Foo:
    def bar(self):
        return 1

Regards,
Stefan

Reply via email to