17

I know it is possible to invoke Java when Perl 6 is using that backend: How do I invoke a Java method from perl6

Is there a way yet to access e.g. the JavaScript DOM interface from Perl 6 with the new Rakudo JavaScript VM running in the browser?

Perhaps something like this:

use v6;
use javascript::dom:from<JavaScript>;
Pat
  • 36,282
  • 18
  • 72
  • 87
S. Albano
  • 707
  • 7
  • 21
  • The DOM APIs are not part of JavaScript; they're services exposed by web browsers. That said, it's possible that some sort of "virtual" DOM is available for doing things like screen scraping. – Pointy Oct 09 '18 at 18:36
  • Yes, and I would expect that the DOM API could be made available to Perl 6 running on JavaScript in the browser. – S. Albano Oct 09 '18 at 18:41
  • Note that "Java" and "JavaScript" are completely different, unrelated languages. – Pointy Oct 09 '18 at 18:53
  • 3
    I know. Perl 6 can use them both as backend virtual machines. The three it supports are Moar, JVM and now JavaScript. – S. Albano Oct 09 '18 at 18:54
  • Oh OK. Well I don't see any mention of that in the Rakudo documentation, but it doesn't seem unlikely. – Pointy Oct 09 '18 at 18:57
  • 3
    It is very new: http://blogs.perl.org/users/pawel_murias/2018/10/rakudojs-update---it-has-been-merged-into-master-plus-6pad-unveiling.html. I just heard about it today. – S. Albano Oct 09 '18 at 19:00
  • 3
    I've pinged Pawel Murias about this question. I hope he'll be able to provide you with an answer in the next 24 hours or so. – Elizabeth Mattijsen Oct 09 '18 at 20:41

1 Answers1

5

You can now access the DOM using EVAL(:lang, 'return document') See https://perl6.github.io/6pad/#4ee170f8043efe4802c8e6fb55d6a187 for an example.

pmurias
  • 66
  • 1
  • 3