As discussed in Corion's reply and my follow-up, getting modules into WebPerl takes a bit of work, especially modules with XS/C code, and sockets are a much more complex topic. The typical way to approach this kind of thing is to have a server (in this case probably the Mojolicious::Lite app) communicate with the browser with e.g. HTTP+JSON. The repository contains an example of using jQuery's ajax method here and a native XMLHttpRequest here - the latter example is a synchronous request, which is not typical, but since translating JavaScript to Perl is fairly straightforward, many of the examples of using XMLHttpRequest can be easily translated.

In your reply here you said:

Even php is banned for the end user.

I'm not sure what you mean here - do you mean you can't even use PHP on the server side? That'd be a pretty strange restriction, given that based on your question, apparently your database server would be reachable from the clients?

I think if you re-think the architecture a little bit, the whole thing is doable with WebPerl: Instead of trying to put everything in the browser, you can split it up: One Perl script, running locally, acts as the webserver (Mojolicious::Lite), and it can also launch the browser, which accesses that local webserver, and the webserver serves up a HTML page with an embedded WebPerl script, acting as the GUI, which can then communicate with the local webserver as mentioned above. While the WebPerl script is pretty much sandboxed in the browser, the local webserver can do anything that a normal Perl script on the machine can, i.e. access local files, open network connections, etc.


In reply to Re: Mojolicious::Lite and Webperl by haukex
in thread Mojolicious::Lite and Webperl by frazap

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.