in reply to Converting Tk based Perl to be used on the Interent

Hi, in the past, there was an attempt to make a web-browser addon that would run Tk in a Browser, like Java, it was called the PerlPlus Plugin, but it's a security nightmare since Perl and Tk can access the whole filesystem.

So the next best thing, for over-the-internet-usage would be to run it via ssh. SSH has an option on the server to export the X session to the remote client. This works very well but has many drawbacks, such as
(1) your server must run with an X server going, which is not considered safe for large servers
(2)you have to allow your clients to have ssh access. If there are too many, it will bog things down, plus it's not easy for clients to setup.
(3)it's not browser based

Other than that, you will probably need to use javascript, css, and cgi to put together a similar page which a browser can use.

If it is just a handful of trusted clients, and you have control over your server so as to run an X-server, ssh is not a bad option. It would be similar to the VNC as mentioned by InfiniteSilence above.

It would be great if someone can develop a chopped down version of Perl, suitable to work as a browser plugin, much like the Java plugin.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: Converting Tk based Perl to be used on the Interent

Replies are listed 'Best First'.
Re^2: Converting Tk based Perl to be used on the Internet (meditation)
by LanX (Saint) on May 18, 2014 at 19:02 UTC
    It's been over a decade that I really worked with Tk, but here some meditation on the subject.

    I'll address it to you since I know that you are quite an expert on this subject.

    so IMHO

    1. Tk heavily relies on callbacks.

    2. The aim of those callbacks is located somewhere between 2 extremes4

      • a) manipulating the GUI (e.g reordering elements)
      • b) interacting with the application. (e.g. access DB)

    3. Since Perl doesn't run within browsers, there are 2 options for those callbacks
      • A) porting to JS
      • B) tunneling callbacks via http to the server¹

    4. For different reasons one would mainly like to go
      • a -> A # performance
      • b -> B # complexity, server bound

    5. While it certainly is possible to mimic most (or all) Tk-widgets in HTML&JS, it's pretty unlikely to have an AI which analyzes the code to split it into a) and b) parts.

    6. The most likely solution is to design a meta-language (maybe even a DSL) which is already addressing these needs.

    7. This meta approach would create the necessary output in either Perl/Tk or Perl+JS/HTML²

    8. having a restricted sub-dialect (intersection) which reliably translates Perl <-> JS shouldn't be impossible.³

    What ya think, did I miss something?

    footnotes

    ¹) with different possible approaches for client-server communication:

    • classic http
    • AJAX
    • Web-Sockets (bidirectional)

    ²) or even other targets like Perl/Tkx or Perl/Wx or even Lisp/Emacs or whatever

    ³) But this restricted "Perl" could look very strange, e.g. only allowing scalars and hence only array-refs and hash-refs like

    $array->push($a,$b)   <->   array.push(a,b)

    ... or only allowing function scopes and no block scopes (JS does hoisting of lexicals)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

    updates

    moved side-notes to footnotes.

    more footnotes

    4) somehow analogous to the MVC paradigm, making a distinction between template code (View) and pure Perl code (Controller).

      You're hired! When can you start? :-)

      Seriously, I think that Tk is out of the running for browser based displays, for all the reasons you mentioned.

      I think that gtk3 may be the way. Why? Because firefox and many other open source browsers are currently gtk2/gtk3 based. That means that under the hood, they both would utilize the same signals and callback system.

      It looks like Python is moving forward with pyXPCOM and similar interfaces, and IIRC there is a configure option in the newer mozilla browsers to enable experimental Python support.

      It seems to me that Perl needs to get involved with XPCOM. It currently has C, C++, Python and Ruby. Where's Perl?

      Of course, I find the whole desire to run everything in a web browser rather disgusting, resulting in code bloat and html/javascript which is as hard to read as assembly language.

      In my little world, I would rather write custom scripts for clients to connect, vis ssh, keeping the browser and http servers out of it all together. :-)


      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh
      Thank you for that.
      I am struggling a bit since although I have been using Perl for over ten years and general programming for decades before that I simply have not anywhere near the Internet programming world.
      I think you have said that Java can mimic the most Tk widgets so would be one thing to look at.
      With Java would you be able to mimic the behaviour of altering say the contents of a pull down menu because a specific radio has been used.
      What do you mean by 'meta language' and a 'DSL'?
Re^2: Converting Tk based Perl to be used on the Interent
by LanX (Saint) on May 18, 2014 at 13:45 UTC
    > It would be great if someone can develop a chopped down version of Perl, ...

    Something like perlito ? :)

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      Pretty cool. I know recently, I saw the gtk3 c-libs had a javascript translation, and that might combine with Perlito to allow us to open windows in a browser. Better yet, would be to get Perl incorporated into something like the Silverlight-Python project to actually embed Python into Firefox. See PyGtk in a web Browser

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh