Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Control the browser with Perl6

by nikosv (Chaplain)
on Feb 24, 2012 at 06:34 UTC ( #955879=perlquestion: print w/replies, xml ) Need Help??
nikosv has asked for the wisdom of the Perl Monks concerning the following question:

Marhall's comment on Re: Need to fill password in with perl on Javascript? made me think that with Parrot will come better interop between languages,which means that you could control the browser using Perl6 calling Javascript libraries,since everything bolts down to PIR acting as the common language denominator.

There is an attempt to port Javascript on Parrot

Is this assumption valid?

Replies are listed 'Best First'.
Re: Control the browser with Perl6
by Corion (Pope) on Feb 24, 2012 at 06:40 UTC

    For controlling "the browser", that is, Firefox, you only need a TCP connection to the mozrepl plugin. If you want to write your own Javascript-capable browser, then it could be beneficial to reuse a Javascript interpreter written for Parrot, if you tie yourself to Parrot. But the main work of writing a Javascript-capable browser is implementing enough of a credible DOM so that most of the Javascript on a page works.

Re: Control the browser with Perl6
by moritz (Cardinal) on Feb 24, 2012 at 07:12 UTC

    That is indeed Parrot's vision for the distant future, but even I as a Perl 6 developer and advocate think that it's far off in the future.

    Browsers embed highly specialized and optimized javascript JIT compilers, and a general-purpose dynamic VM like parrot can't really hope to compete in terms of speed any time soon. And since speed is a major concern for browsers, we can't really expect to see wide spread adoption of parrot on the browser level until the performance issues have been sorted out.

      Wasn't there a plan to run Perl 6 on Google's JS engine sometime back. What happened to that?

        Wasn't there a plan to run Perl 6 on Google's JS engine sometime back. What happened to that?

        Cash is cash :) Perlito/v6

Re: Control the browser with Perl6
by Marshall (Abbot) on Feb 24, 2012 at 07:49 UTC
    In the "Library for WWW with Perl", (LWP) "wars", Corion's Mechanize::Firefox is like the ultimate "nuclear weapon"!

    It is possible to telnet into Firefox (if you have the MozRepl add-on installed) and "drive it around" and that is just way cool! WWW::Mechanize::Firefox uses that interface.

    I have no idea of how to run JavaScript from within Perl. The good news is that most of the time, you don't have to do it (actually run the JavaScript).

      "Ultimate" is subjective. :) The various Webkit Perl bindings are technically superior, Mozrepl is a crummy hack compared to driving a browser around on the windowing/widget level.

      Mech-Firefox maintains the overall advantage because of its copious documentation and Corion diligently giving support.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://955879]
Approved by moritz
Front-paged by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2018-06-20 19:49 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.