Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Java programming and Perl

by tobyink (Abbot)
on Dec 03, 2012 at 18:36 UTC ( #1006924=note: print w/replies, xml ) Need Help??

in reply to Java programming and Perl

It's possible to call Java code from Perl using Inline::Java. An example module that does so is XML::Saxon::XSLT2.

There are similar inline modules for other programming languages - Inline::C, Inline::Ruby, Inline::Lua, etc.

The other way around - calling Perl from other programming languages - is also possible. Perl can be compiled as a library ("libperl") which can be embedded into C programs; and thus theoretically be called from any other programming language capable of linking against C libraries. There exists a PECL module allowing Perl to be embedded in PHP.

I don't think this would be a fruitful or indeed sane way of getting Perl running on Android though. Maybe look at perldroid?

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: Java programming and Perl
by heatblazer (Scribe) on Dec 03, 2012 at 18:40 UTC

    So let`s say I can make a libperl then call it like a C code with java native interface?

      Yes - as I understand it, this is what perldroid does.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

        I`ll look at it ASAP. I am intermediate Perl user and I want to add it`s functionality to java programs so I guess it`s my choice.

        Thank you

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006924]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2018-06-22 15:45 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.