Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Mojolicious::Lite and Webperl

by frazap (Monk)
on Apr 09, 2019 at 13:45 UTC ( #1232354=note: print w/replies, xml ) Need Help??


in reply to Re: Mojolicious::Lite and Webperl
in thread Mojolicious::Lite and Webperl

I'm not sure what you mean here - do you mean you can't even use PHP on the server side?

Web pages have to be edited with ModX revolution, and php code can't be added using this tool (as it is configured). Running the mojolicious lite script from a pc, with starting the script at pc launch, would be a poor man's server, better this is better then nothing. I can link to this Mojolicious::Lite page using the pc IP address.

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.

do you mean: anyone interested would have to download the packed script ? That would not work for Mac or *nix users.

Why using WebPerl to build the GUI ?

Or do I misunderstand ?

Replies are listed 'Best First'.
Re^3: Mojolicious::Lite and Webperl
by haukex (Bishop) on Apr 10, 2019 at 08:21 UTC
    do you mean: anyone interested would have to download the packed script ?

    Everything could still be packed into one distribution: the local webserver script plus the files it serves to the local browser, which would include the WebPerl code.

    Why using WebPerl to build the GUI ?

    You don't say if you've already built a GUI, and if you have, what toolkit you used? WebPerl allows one to basically replace JavaScript, so it's possible to write a fully interactive GUI in the browser, using Perl instead of JS. If you've already got a GUI written with a different toolkit, then it's currently not possible to just put that into WebPerl and have it work.

    It's unfortunately also currently not possible to just stick any interactive command-line script into WebPerl, because reading from STDIN is blocking, and doing blocking I/O, while not impossible, requires some pretty complex workarounds. (I've got this in the back of my head, and if I see some possible workarounds showing up, I'd see if I could implement those.) So while some Perl code can be copied directly into WebPerl, other Perl code requires one to think about the limitations inherent in the browser environment.

Re^3: Mojolicious::Lite and Webperl
by haukex (Bishop) on Apr 10, 2019 at 16:31 UTC

    There are now two examples available:

    • WebPerl Basic GUI Example - the local web server is Plack, and it shows how to access a DBD::SQLite database on the local machine; the frontend (in the browser) is written in Perl without the help of any JavaScript libraries.
    • WebPerl Advanced GUI Example - the local web server is a Mojolicious::Lite app, and the frontend is of course also written in Perl, but this time including Bootstrap and jQuery. (This example doesn't implement anything fancy on the server side, it just shows how to communicate with the server via JSON.)

    I've implemented both so they can be packed by PAR-Packer (tested on Linux).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1232354]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2020-07-12 09:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?