Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inline::Python but vice versa

1 view
Skip to first unread message

Konovalov, Vadim

unread,
Dec 13, 2014, 8:00:03 AM12/13/14
to inl...@perl.org
Dear Stefan,
First of all, thank you for maintaining such a useful module,

All other supporters, thank you to make the really nice module possible :)

A hopefully simple question,
Is it possible to use Perl from Python?

All I want to do - to script some editor with perl, whereas only python scripting is available...
Of course my editor-api calls will be issued with Inline::Python or something like that.

Interested in solutions that are not only theoretical but verified in practice :)

Thanks in advance,
Vadim.

Stefan Seifert

unread,
Dec 13, 2014, 8:15:02 AM12/13/14
to inl...@perl.org
Hi Vadim,

On Saturday 13 December 2014 12:44:22 Konovalov, Vadim wrote:

> A hopefully simple question,
> Is it possible to use Perl from Python?
>
> All I want to do - to script some editor with perl, whereas only python
> scripting is available... Of course my editor-api calls will be issued with
> Inline::Python or something like that.

You mean your editor is written in Perl and you want to allow for your users
to script it in Python and these Python scripts should be able to call back
into Perl to for example call API methods?

Yes, that's exactly what my use case looks like and probably what's tested
best. You could for example pass an Editor object as parameter to your Python
script and the script may use it like it was a plain normal Python object and
call methods on it.

https://metacpan.org/pod/distribution/Inline-Python/Python.pod#Using-Perl-inside-Python-inside-Perl may give you additional pointers to what's possible.

Please feel free to ask any questions that may come up on how to integrate
Python scripting. I do have quite some experience on how to bridge these two
languages and am happy to help.

Regards,
Stefan

Konovalov, Vadim

unread,
Dec 13, 2014, 8:45:02 AM12/13/14
to Stefan Seifert, inl...@perl.org
From: Stefan Seifert [mailto:ni...@detonation.org]
> On Saturday 13 December 2014 12:44:22 Konovalov, Vadim wrote:
>
> > A hopefully simple question,
> > Is it possible to use Perl from Python?
> >
> > All I want to do - to script some editor with perl, whereas only
> > python scripting is available...
>
> You mean your editor is written in Perl and you want to
> allow for your users to script it in Python and these
> Python scripts should be able to call back into Perl to for
> example call API methods?

No,
There is existing editor (e.g. sublime or maybe KIG - KDE 2D-geometry)
which is scripted by python already,
but I want to use Perl from there.

What I actually want - is a module inside vanilla python that allows me to run Perl, ...

I've read "Using-Perl-inside-Python-inside-Perl" but seems to me this isn't exactly what helps me in this situation.
Yet I already used Perl-inside-Python-inside-Perl :)
The cool stuff possible with Inline::Python is that I can write fully functional application with Qt, whereas Qt used via Python (perlQt are all stale) and I was able to do this way -

use Inline Python => <<'EOS';
.......
self.pushButton = QtGui.QPushButton("&Foo Button")
.....
self.pushButton.clicked.connect(perl.qwerty);
......
EOS

my $app = get_app();
my $w = init_some_window();

sub qwerty {
$w->{pushButton}->setText('['.$w->{pushButton}->text().']');
}

$app->exec_();

Really really really cool stuff :)

Have a nice day,
Vadim.
0 new messages