From 809110e2f29b0747d2c533edea7b2bdb54808767 Mon Sep 17 00:00:00 2001 From: "Flavio S. Glock" Date: Fri, 18 Aug 2017 09:57:18 +0200 Subject: [PATCH] document calling Perl from JavaScript --- README-perlito5-JavaScript.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README-perlito5-JavaScript.md b/README-perlito5-JavaScript.md index 63b54b5ad..216dd9662 100644 --- a/README-perlito5-JavaScript.md +++ b/README-perlito5-JavaScript.md @@ -87,6 +87,23 @@ Perlito5-in-JavaScript differences from "perl" - runtime error messages often do not include the right line number in the Perl code +Calling Perl subroutines from JavaScript +========= + +- var myfun = p5cget( "My::Module", "mysub" ); + + Export a Perl subroutine to a JavaScript variable + +- var myobj = p5cget( "My::Module", "mysub" )( [ arg1, arg2 ], null ); + + Call a Perl subroutine. + The "null" in the end means calling in scalar context. + +- var myobj = p5call( "Statistics::Distributions", "new", [ arg1, arg2 ], null ); + + Method call. + + Internals =========