var Perl = require('perl').Perl;
var perl = new Perl();
var ret = perl.evaluate("reverse 'yappo'");
console.log(ret); // => oppay
var Perl = require('../index.js').Perl;
var perl = new Perl();
perl.use('LWP::UserAgent');
var ua = perl.getClass('LWP::UserAgent').new();
var res = ua.get('http://utf-8.jp/');
console.log(res.as_string());
Create new instance of Perl.
evaluate the perl code and get a return value.
Get a class object(Instance of PerlClass) from perl.
Same as Scalar::Util::blessed.
Get a PerlMethod object.
Get a PerlMethod object.
You can get a instance of this class by Perl#getClass.
Get a PerlMethod object.
Call perl5 function and get a return value in scalar context. You get a exception when Perl5 throws exception.
Same as above, but callList calls function in list context.
node-perl requires a perl5 binary built with -fPIC and -Duseshrplib. Normally, linux distribution's system perl is usable.
You can build a perl binary for node-perl with perlbrew command.
$ PERLBREW_CONFIGURE_FLAGS=-de perlbrew install perl-5.16.1 -Duseshrplib -Duseithreads -Dusethreads -Accflags='-fPIC' -nv
$ perlbrew use perl-5.16.1
If you got a error while loading libperl.dylib, please set a DYLD_LIBRARY_PATH
to perl5 library path.
- The calls to Perl are synchronous ones.
Based on https://github.com/tokuhirom/node-perl
Based on https://github.com/hideo55/node-perl.
MIT