in reply to Run Perl 5 in the Browser!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Run Perl 5 in the Browser!
by haukex (Archbishop) on Oct 06, 2018 at 10:33 UTC | |
Are you exposing an API or you have a DSL? In Perl scripts running inside WebPerl, I expose all of JavaScript to Perl, in two ways: So this way, you can do everything in Perl, and use normal Perl operations to manipulate Perl objects, which actually runs JavaScript in the background. The interface is documented here. The gory guts can be found in WebPerl.pm and WebPerl.xs (with some supporting code, such as Perl.glue() and Perl.dispatch(), in webperl.js). (You'll see that currently, a lot is done with copying strings back and forth between JS and Perl, and with both JS's and Perl's eval, which in some places could probably be optimized in a future version.) How can you a access the Dom with Perl? Since you can use all of JavaScript, you can use native JS (like the example LanX showed), or any JavaScript library of your choice, such as jQuery. I show examples of both in the source webperl_demo.html (don't mind the currently screwy syntax highlighting on GitHub that's highlighting stuff in dark red). Let me know if you have any further questions! Minor edits to add a few small details. | [reply] [d/l] [select] |
Re^2: Run Perl 5 in the Browser!
by LanX (Saint) on Oct 05, 2018 at 17:32 UTC | |
There where various examples how it looks like in this thread. e.g. in Re^2: Run Perl 5 in the Browser!
so you could interpret method chaining as a "DSL" (at least Fowler does)
Cheers Rolf
| [reply] [d/l] |