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:

²) 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).


In reply to Re^2: Converting Tk based Perl to be used on the Internet (meditation) by LanX
in thread Converting Tk based Perl to be used on the Interent by merrymonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.