diff --git a/_misc/wp1.ico b/_misc/wp1.ico new file mode 100644 index 0000000..e4559b8 Binary files /dev/null and b/_misc/wp1.ico differ diff --git a/_misc/wp2.ico b/_misc/wp2.ico new file mode 100644 index 0000000..ecc773d Binary files /dev/null and b/_misc/wp2.ico differ diff --git a/_misc/wp3.ico b/_misc/wp3.ico new file mode 100644 index 0000000..3df4766 Binary files /dev/null and b/_misc/wp3.ico differ diff --git a/building.md b/building.md index ac715ed..4c6ec77 100644 --- a/building.md +++ b/building.md @@ -1,9 +1,10 @@ \[ [Using](using.html) - Building - +[🦋](perl6.html) - [Notes](notes.html) - [Legal](legal.html) - -[GitHub Wiki](https://github.com/haukex/webperl/wiki/Building-WebPerl) \] +[Wiki](https://github.com/haukex/webperl/wiki/Building-WebPerl) \] Building WebPerl ================ @@ -13,6 +14,9 @@ Building WebPerl Some things may not work yet, and parts of the API may still change. Your feedback is always appreciated! +This page documents the Perl 5 support, for the *experimental* +Perl 6 support, see [here](perl6.html). + Prerequisites ------------- diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..3df4766 Binary files /dev/null and b/favicon.ico differ diff --git a/index.md b/index.md index 87f6573..081ebab 100644 --- a/index.md +++ b/index.md @@ -1,16 +1,17 @@ \[ [Using](using.html) - [Building](building.html) - +[🦋](perl6.html) - [Notes](notes.html) - [Legal](legal.html) - -[GitHub Wiki](https://github.com/haukex/webperl/wiki) \] +[Wiki](https://github.com/haukex/webperl/wiki) \] Welcome to WebPerl! =================== WebPerl uses the power of [WebAssembly](https://webassembly.org/) and -[Emscripten](http://emscripten.org/) to let you run Perl 5 in the browser! +[Emscripten](http://emscripten.org/) to let you run Perl in the browser! WebPerl does not translate your Perl code to JavaScript, instead, it is a port of the `perl` binary to WebAssembly, so that you have the full @@ -20,6 +21,8 @@ power of Perl at your disposal! Some things may not work yet, and parts of the API may still change. Your feedback is always appreciated! +[**New: Experimental Perl 6 Support**](perl6.html) + ```html + +``` + + +Quick Start +----------- + +- Prerequisites: `perl` (a recent version is recommended, e.g. v5.26 and up), + and [`cpanm`](https://metacpan.org/pod/App::cpanminus) to easily install + dependencies (otherwise, see the files `cpanfile` for the dependencies and + use the module installer of your choce). + +- In a shell (the following assumes Linux): + + $ git clone https://github.com/haukex/webperl.git + $ cd webperl + $ wget https://github.com/haukex/webperl/releases/download/v0.07-beta/webperl_prebuilt_v0.07-beta.zip + $ unzip -j webperl_prebuilt_v0.07-beta.zip '*/emperl.*' -d web + $ cpanm --installdeps . + $ cd experiments ; cpanm --installdeps . ; cd .. + $ experiments/p6/6init.pl # this patches Perl 6 support in + $ plackup web/webperl.psgi + +- Then point your Chrome browser at , + and have a look at its source. + +Have fun! + + +Experimental Status and Notes +----------------------------- + +- I don't have enough experience with `Rakudo.js` + - + - + - + - + - + +- requires BigInt support, which is currently only available in Chrome + - + - + - + +- Large download (10MB compressed, 74MB uncompressed) - can we + repackage it to make it smaller, or is there a good way to + distribute this? + +- STDERR only goes to console, STDOUT gets output with HTML escapes + + +Documentation +------------- + +My code steal^H^H^H^H^Hborrows the prepackaged `Rakudo.js` build from +[6Pad](https://perl6.github.io/6pad/) and caches it locally. The script +`experiments/p6/6init.pl` also patches the experimental P6 support into +`webperl.js` (see the [Quick Start](#quick-start) above). + +Note that both Perl 5 and Perl 6 are only loaded on demand by +`webperl.js`, so if you only use one or the other, you won't have the +overhead of loading both. + +For now, I've basically just patched `Rakudo.js`'s `evalP6()` into +`Raku.eval()`, and `NQP_STDOUT` into `Raku.output`, to make things more +like the Perl 5 WebPerl, and provided some of the same API for Perl 6 +as I provide for Perl 5. + +The JS API provided by WebPerl for Perl 6 currently closely mirrors +[the Perl 5 API](using.html#webperljs): There is a JS object `Raku` +which provides the following functions / properties that do mostly the +same as for Perl 5: + +- `Raku.addStateChangeListener( function (from,to) {} )` +- `Raku.state` +- `Raku.output = function (str,chan) {}` +- `Raku.makeOutputTextarea()` +- `Raku.init( function () {} )` +- `Raku.eval( code )` + +You can add Perl 6 code to your HTML pages with `` tag will cause `webperl.js` to fetch `foo.pl` from the *web server*, not the virtual filesystem! - *However*, that Perl script will *also* only see the virtual filesystem, - not the web server, so it won't even be able to see "itself". You can still - fetch things from the webserver using e.g. AJAX requests. + not the web server, so it won't even be able to see "itself" (`webperl.js` + may save files such as `/tmp/scripts.pl`, but that's *not* guaranteed). + You can still fetch things from the webserver using e.g. AJAX requests. While a WebPerl instance is running, you can modify files in the virtual file system as you might be used to from regular Perl. But the virtual filesystem is reloaded every @@ -291,6 +295,7 @@ either. If you need to safely store files, it's best to store them on the user's In particular, even though you might make heavy use of `/mnt/idb` when testing with the "mini IDE", remember that this storage is *not* a way to distribute files to your users, and in fact, some users' browsers may automatically regularly clear the `IndexedDB`, or have it disabled altogether. +It also may not work at all in a "sandboxed" `iframe`. For providing your application to your users, either use `