Skip to content

Commit 585132b

Browse files
committed
documentation update
1 parent 7c8cf01 commit 585132b

File tree

8 files changed

+190
-187
lines changed

8 files changed

+190
-187
lines changed

CREDITS.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,18 @@ https://wiki.qt.io/Open_Web_Page_in_QWebView
7474

7575
https://forum.qt.io/topic/18879/relative-path-on-qmake-pro-file
7676
https://forum.qt.io/topic/551/get-filename-without-extension
77-
https://forum.qt.io/topic/45982/solved-is-there-a-problem-with-the-following-non-blocking-sleep-function
7877
https://forum.qt.io/topic/3314/qwebelement-set-and-get-attribute
7978

80-
http://www.qtcentre.org/threads/25880-QWebView-prints-PDF-file-OK-with-QPrintDialog-only
8179
http://www.qtcentre.org/threads/46016-Place-QMessageBox-on-middle-of-screen
8280
http://www.qtcentre.org/threads/18146-String-operations-printing-to-stdout
8381
http://www.qtcentre.org/threads/29363-Problem-with-QDir-cdUp()
8482
http://www.qtcentre.org/threads/10661-QByteArray-to-QString
85-
http://www.qtcentre.org/threads/28302-Passing-Command-line-arguments-to-a-Qt-application-in-linux
86-
http://www.qtcentre.org/threads/22298-QMessageBox-Controlling-the-width
8783
http://www.qtcentre.org/threads/29104-QMake-DEFINES
8884
http://www.qtcentre.org/threads/48238-Call-a-JavaScript-function-from-C-using-QtWebkit
8985

9086
https://stackoverflow.com/questions/10666998/qwebkit-display-local-webpage
9187
https://stackoverflow.com/questions/7402576/how-to-get-current-working-directory-in-a-qt-application
9288
https://stackoverflow.com/questions/8026101/correct-way-to-quit-a-qt-program
93-
https://stackoverflow.com/questions/8122094/qtwebkit-printing-issue-no-images-on-printed-page
9489
https://stackoverflow.com/questions/12571895/save-open-dialog-localization-in-qt
9590
https://stackoverflow.com/questions/6955281/how-to-stop-qhttp-qtwebkit-from-caching-pages
9691
https://stackoverflow.com/questions/3211771/how-to-convert-int-to-qstring
@@ -104,7 +99,6 @@ https://stackoverflow.com/questions/7228826/how-can-i-convert-qvariant-to-qstrin
10499
https://stackoverflow.com/questions/2580934/how-to-specify-different-debug-release-output-directories-in-qmake-pro-file
105100
https://stackoverflow.com/questions/3348711/add-a-define-to-qmake-with-a-value
106101
https://stackoverflow.com/questions/4515602/how-to-get-executable-name-in-qt
107-
https://stackoverflow.com/questions/2781119/how-to-get-the-current-timestamp-in-qt
108102
https://stackoverflow.com/questions/19505063/qt-javascript-execution-slow-unless-i-log-to-the-console
109103
https://stackoverflow.com/questions/15864689/qmake-pre-build-step-before-any-compilation
110104
https://stackoverflow.com/questions/17480984/qt-how-do-i-handle-the-event-of-the-user-pressing-the-x-close-button
@@ -142,7 +136,6 @@ https://www.perlmonks.org/bare/?node_id=768448 "Permanently sort a hash"
142136
https://www.perlmonks.org/?node_id=27443 "Checking to see if a particular Module is installed"
143137
https://www.perlmonks.org/?node_id=982572 "ScanDeps usage"
144138

145-
https://stackoverflow.com/questions/1725097/how-can-i-disable-terminal-polling-for-cpan-used-from-crontab
146139
https://stackoverflow.com/questions/4510550/using-perl-how-do-i-decode-or-create-those-encodings-on-the-web
147140
https://stackoverflow.com/questions/5741101/easy-way-to-print-perl-array-with-a-little-formatting
148141
https://stackoverflow.com/questions/15210532/use-utf8-gives-me-wide-character-in-print
@@ -151,7 +144,6 @@ https://stackoverflow.com/questions/229357/what-is-the-best-way-in-perl-to-copy-
151144

152145
https://perlmaven.com/manipulating-perl-arrays
153146
https://perlmaven.com/how-to-sort-a-hash-in-perl
154-
https://perlmaven.com/recursive-subroutines
155147

156148
http://lauraliparulo.altervista.org/first-steps-in-sqlite-and-perl/
157149

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,21 @@ Perl Executing Browser (PEB) is an HTML5 user interface for [Perl 5](https://www
2121
* [Runtime Requirements](./doc/REQUIREMENTS.md#runtime-requirements)
2222
* [CONSTANTS](./doc/CONSTANTS.md)
2323
* [Files and Folders](./doc/CONSTANTS.md#files-and-folders)
24-
* [Functional Pseudo Filename](./doc/CONSTANTS.md#functional-pseudo-filename)
24+
* [About URL](./doc/CONSTANTS.md#about-url)
2525
* [SETTINGS](./doc/SETTINGS.md)
2626
* [Application Filename](./doc/SETTINGS.md#application-filename)
27-
* [HTML Page API](./doc/SETTINGS.md#html-page-api)
27+
* [Global Settings API](./doc/SETTINGS.md#global-settings-api)
2828
* [Perl Scripts API](./doc/SETTINGS.md#perl-scripts-api)
29-
* [Interactive Perl Scripts](./doc/SETTINGS.md#interactive-perl-scripts)
30-
* [Selecting Files and Folders](./doc/SETTINGS.md#selecting-files-and-folders)
31-
* [LOGGING](./doc/LOGGING.md)
32-
* [PACKAGING](./doc/PACKAGING.md)
33-
* [AppImage Support](./doc/PACKAGING.md#appimage-support)
29+
* [Files and Folders Dialogs API](./doc/SETTINGS.md#files-and-folders-dialogs-api)
30+
* [INTERACTIVE PERL SCRIPTS](./doc/INTERACTIVE.md)
31+
* [Requirements for Interactive Perl Scripts](./doc/INTERACTIVE.md#requirements-for-interactive-perl-scripts)
32+
* [Examples of Interactive Perl Scripts](./doc/INTERACTIVE.md#examples-of-interactive-perl-scripts)
33+
* [APPIMAGE SUPPORT](./doc/APPIMAGE.md)
34+
* [PEB AppImage Maker](./doc/APPIMAGE.md#peb-appimage-maker)
35+
* [PEB AppImage Configuration Files](./doc/APPIMAGE.md#peb-appimage-configuration-files)
36+
* [PEB AppImage Builder Docker Container](./doc/APPIMAGE.md#peb-appimage-builder-docker-container)
37+
* [AppImageHub](./doc/APPIMAGE.md#appimagehub)
38+
* [Logging](./doc/LOGGING.md)
3439
* [History](#history)
3540
* [License](./LICENSE.md)
3641
* [Thanks and Credits](./CREDITS.md)

doc/APPIMAGE.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Perl Executing Browser - AppImage Support
2+
3+
## PEB AppImage Maker
4+
5+
PEB or any PEB-based application can be easily packed as a 64-bit single-file Linux [AppImage](https://appimage.org/) executable by the [PEB AppImage Maker](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/appimage-maker.sh) script, which has two modes of operation:
6+
7+
* packing a Perl application together with a PEB executable, Qt libraries and a relocatable Perl distribution:
8+
9+
```bash
10+
./appimage-maker.sh --include-resources
11+
```
12+
13+
In this case, the PEB AppImage Maker invokes the [Perl Distribution Compactor](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/compactor.pl), which finds all dependencies of all Perl scripts in the ``{PEB_executable_directory}/resources/app`` directory and copies only the necessary Perl modules.
14+
15+
Perl Distribution Compactor depends on [Module::ScanDeps](https://metacpan.org/pod/Module::ScanDeps) and [File::Copy::Recursive](https://metacpan.org/pod/File::Copy::Recursive) CPAN modules, which are included in the ``{PEB_executable_directory}/sdk/lib`` directory.
16+
17+
* packing only a PEB executable and its Qt libraries:
18+
19+
```bash
20+
./appimage-maker.sh --no-resources
21+
```
22+
23+
In this case, a PEB executable from an AppImage will try to find its application files and folders in the directory of the AppImage.
24+
25+
In both modes of operation, the PEB AppImage uses the [linuxdeployqt](https://github.com/probonopd/linuxdeployqt/releases/) tool to detect all Qt dependencies of PEB and build the final image.
26+
27+
The PEB AppImage Maker script must be started from the ``{PEB_executable_directory}/sdk`` directory.
28+
29+
## PEB AppImage Configuration Files
30+
31+
``{PEB_executable_directory}/resources/app/appimage/{application_name}.desktop``
32+
``{PEB_executable_directory}/resources/app/appimage/{application_name}.appdata.xml``
33+
34+
``{PEB_executable_directory}/resources/app/{application_name}.desktop``
35+
is mandatory for any PEB-based application which will be packed by the PEB AppImage Maker.
36+
A minimal example of а ``.desktop`` file is available [here](https://github.com/ddmitov/perl-executing-browser/blob/master/resources/app/peb-demo.desktop).
37+
``Icon=app`` in the ``.desktop`` file must not be changed for the proper display of the application icon.
38+
All registered categories in a ``.desktop`` file are available [here](https://standards.freedesktop.org/menu-spec/latest/apa.html).
39+
Any ``.desktop`` file can be validated using the ``desktop-file-validate`` tool from the ``desktop-file-utils`` package in all major Linux distributions.
40+
41+
The [AppStream Generator](http://output.jsbin.com/qoqukof) of [probonopd](https://github.com/probonopd) is the recommended tool for generating AppStream ``.appdata.xml`` files for PEB-based applications. An example AppStream file is available [here](https://github.com/ddmitov/perl-executing-browser/blob/master/resources/app/peb-demo.appdata.xml). An AppStream file is not mandatory, but is highly recommended.
42+
43+
Both PEB AppImage configuration files are put on their places in the AppImage directory tree structure by the [PEB AppImage Maker](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/appimage-maker.sh) script.
44+
45+
## PEB AppImage Builder Docker Container
46+
47+
An easy building environment for PEB AppImage executables is the [PEB AppImage Builder Docker Container](https://github.com/ddmitov/perl-executing-browser/blob/master/sdk/Dockerfile).
48+
To build it, type the following command in the PEB project root directory (the directory of the README.md):
49+
50+
```bash
51+
sudo docker build -t peb-appimage-builder .
52+
```
53+
54+
To start the PEB AppImage Builder Docker Container, type the following command in the PEB project root directory:
55+
56+
```bash
57+
sudo docker container run --rm -it -v $(pwd):/opt --user $(id -u):$(id -g) peb-appimage-builder
58+
```
59+
60+
When PEB AppImage Builder Docker Container is running, type:
61+
62+
```bash
63+
cd /opt/sdk
64+
```
65+
66+
To start the PEB AppImage Maker, type either:
67+
68+
```bash
69+
./appimage-maker.sh --no-resources
70+
```
71+
72+
or
73+
74+
```bash
75+
./appimage-maker.sh --include-resources
76+
```
77+
78+
To stop the PEB AppImage Builder Docker Container when AppImage building is complete:
79+
<kbd>Ctrl</kbd> + <kbd>D</kbd>
80+
81+
## AppImageHub
82+
83+
Perl Executing Browser is also listed at the [AppImageHub](https://appimage.github.io/perl-executing-browser/).
84+
Any authors of PEB-based Linux applications are encouraged to list their AppImage executables in the same manner.

doc/CONSTANTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ A typical ``{PEB_executable_directory}`` looks like this:
4848
If this file is found during application startup, it is used as the icon of the application and all dialog boxes.
4949
If this file is not found, the default icon embedded in the resources of the browser binary is used.
5050

51-
## Functional Pseudo Filename
51+
## About URL
5252

5353
* **About dialog:** ``about.function``

doc/INTERACTIVE.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Perl Executing Browser - Interactive Perl Scripts
2+
3+
PEB interactive Perl scripts are able to receive user input multiple times after the script is already started thus forming a bidirectional connection with PEB. Many interactive scripts can be started simultaneously in one PEB instance. One script may be started in many instances, provided that each of them has a JavaScript settings object with an unique name.
4+
5+
## Requirements for Interactive Perl Scripts
6+
7+
* **Event Loop**
8+
Each PEB interactive Perl script must have its own event loop waiting constantly for new data on STDIN or in a temporary file for a bidirectional connection with PEB. ``AnyEvent`` is a popular Perl framework for building different types of event loops.
9+
10+
* **No Buffering**
11+
PEB interactive scripts should run with no output buffering, which preventing output before the script has ended.
12+
Output buffering could be disabled using the following code:
13+
14+
```perl
15+
use English;
16+
17+
$OUTPUT_AUTOFLUSH = 1;
18+
```
19+
20+
* **Failsafe Print**
21+
Failsafe print is necessary to shut down PEB Perl scripts when PEB unexpectedly crashes.
22+
Failsafe print could be implemented using the following code:
23+
24+
```perl
25+
print "output string" or shutdown_procedure();
26+
27+
sub shutdown_procedure {
28+
# your shutdown code goes here...
29+
exit();
30+
}
31+
```
32+
33+
## Examples of Interactive Perl Scripts
34+
35+
The following code shows how to start a PEB interactive Perl script right after the PEB index page is loaded:
36+
37+
```html
38+
<!DOCTYPE html>
39+
<html>
40+
<head>
41+
<title>Interactive Script Demo</title>
42+
<meta name="viewport" content="width=device-width, initial-scale=1">
43+
<meta charset="utf-8">
44+
45+
<script>
46+
var pebSettings = {};
47+
pebSettings.autoStartScripts = ['interactive_script'];
48+
49+
var interactive_script = {};
50+
interactive_script.scriptRelativePath = 'perl/interactive.pl';
51+
interactive_script.inputData = function() {
52+
return document.getElementById('interactive-script-input').value;
53+
}
54+
55+
interactive_script.stdoutFunction = function (stdout) {
56+
var container = document.getElementById('interactive-script-output');
57+
container.innerText = stdout;
58+
}
59+
</script>
60+
</head>
61+
62+
<body>
63+
<form action="interactive_script.script">
64+
<input type="text" name="input" id="interactive-script-input">
65+
<input type="submit" value="Submit">
66+
</form>
67+
68+
<div id="interactive-script-output"></div>
69+
</body>
70+
</html>
71+
```
72+
73+
The [index.htm of the demo package](https://github.com/ddmitov/perl-executing-browser/blob/master/resources/app/index.html) demonstrates how to start automatically one Perl interactive script based on STDIN input in two instances.
74+
75+
The [interactive.pl script of the demo package](https://github.com/ddmitov/perl-executing-browser/blob/master/resources/app/perl/interactive.pl) is an example of a Perl interactive script based on STDIN input.
76+
77+
The [index-windows.htm of the demo package](https://github.com/ddmitov/perl-executing-browser/blob/master/resources/app/index-windows.html) demonstrates how to start automatically one Perl interactive script based on temporary files in two instances.
78+
79+
The [interactive-windows.pl script of the demo package](https://github.com/ddmitov/perl-executing-browser/blob/master/resources/app/perl/interactive-windows.pl) is an example of a Perl interactive script based on temporary files.

doc/LOGGING.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
PEB has unified logging of Perl and JavaScript errors in the JavaScript console.
44
All you need to read Perl errors is to open the JavaScript console.
55

6-
## Using the JavaScript Console on QtWebkit Builds
6+
* To view the JavaScript console on QtWebkit builds
7+
use the keyboard shortcut <kbd>Ctrl</kbd> + <kbd>I</kbd>
8+
to open the ``QWebInspector`` and go to the ``Console`` tab.
79

8-
Start the ``QWebInspector`` using the keyboard shortcut <kbd>Ctrl</kbd> + <kbd>I</kbd> and go to the ``Console`` tab.
10+
* To view the JavaScript console on QtWebEngine builds
11+
start PEB with the following command-line argument supplying an arbitrary private port:
912

10-
## Using the JavaScript Console on QtWebEngine Builds
13+
```bash
14+
peb --remote-debugging-port=8080
15+
```
1116

12-
Start PEB with the following command-line argument supplying an arbitrary private port:
17+
and open the local URL with the supplied port using another browser
1318

14-
```bash
15-
peb --remote-debugging-port=8080
16-
```
19+
``http://localhost:8080``
1720

18-
and open the following URL using another browser:
19-
20-
``http://localhost:8080``
21-
22-
to access the ``QtWebEngine Developer Tools``, then go to the ``Console`` tab.
21+
to access the ``QtWebEngine Developer Tools``, then go to the ``Console`` tab.

doc/PACKAGING.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)