Skip to content

Commit ddc3688

Browse files
committed
documentation update
1 parent be5a642 commit ddc3688

File tree

3 files changed

+18
-22
lines changed

3 files changed

+18
-22
lines changed

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Perl Executing Browser (PEB) is an HTML GUI for [Perl 5](https://www.perl.org/)
1111
* [Compile-time Requirements](#compile-time-requirements)
1212
* [Runtime Requirements](#runtime-requirements)
1313
* [Calling User Perl Scripts](#calling-user-perl-scripts)
14-
* [Calling Linux Superuser Scripts](#calling-linux-superuser-scripts)
14+
* [Calling Linux Superuser Perl Scripts](#calling-linux-superuser-perl-scripts)
1515
* [Settings](#settings)
1616
* [Security](#security)
1717
* [Special URLs for Users](#special-urls-for-users)
@@ -78,10 +78,10 @@ Perl Executing Browser (PEB) is an HTML GUI for [Perl 5](https://www.perl.org/)
7878
* Extensive optional logging of all browser actions.
7979

8080
## Compile-time Requirements
81-
GCC compiler and Qt 5.1 - Qt 5.5 headers (including ```QtWebKit``` headers).
82-
Later versions of Qt are unusable due to the deprecation of ```QtWebKit```.
81+
GCC compiler and Qt 5.1 - Qt 5.5 headers.
82+
Later versions of Qt could be usable if ```QtWebKit``` headers and libraries are manually added, but this approach is still not tested.
8383

84-
The most important Qt dependency of PEB is actually not the ```QtWebkit``` set of classes, but ```QNetworkAccessManager``` class, which is subclassed to implement the local pseudo-domain of PEB and all requests to local content. The removal of this class from the ecosystem of ```QtWebEngine```, the new Blink-based web engine of Qt, means that transition to ```QtWebEngine``` remains problematic.
84+
The most important Qt dependency of PEB is actually not the ```QtWebkit``` set of classes, but ```QNetworkAccessManager```, which is subclassed to implement the local pseudo-domain of PEB and all requests to local content. The removal of this class from the ecosystem of ```QtWebEngine```, the new Blink-based web engine of Qt, means that transition to ```QtWebEngine``` is problematic.
8585

8686
Compiled and tested successfully using:
8787
* [Qt Creator 2.8.1 and Qt 5.1.1](http://download.qt.io/official_releases/qt/5.1/5.1.1/) on 32-bit Debian Linux,
@@ -104,24 +104,22 @@ Compiled and tested successfully using:
104104
## Calling User Perl Scripts
105105
PEB recognizes two types of local user-level Perl scripts: **long running scripts** and **AJAX scripts**.
106106
There is no timeout for all Perl scripts executed by PEB.
107-
* **Long running Perl scripts:**
108-
Long running Perl scripts are expected to produce either:
107+
* **Types of Long Running Perl Scripts:**
108+
**1. page-producing scripts:**
109+
They produce complete HTML pages and no special settings are necessary when they are called from a local page. There can be multiple chunks of output from such a script - PEB accumulates them all and displays everything when the script is finished.
109110

110-
**1.** a complete HTML page that will replace the calling page:
111-
If a complete HTML page is expected from the Perl script that is called, no special settings should be added. There can be multiple chunks of output from such a script - PEB accumulates them all and displays everything when the script is finished.
112-
113-
**2.** pieces of data that will be inserted one after the other into the calling page using JavaScript:
114-
If script output is going to be inserted piece by piece into the HTML DOM of the calling page, then a special query item should be inserted into the script URL.
111+
**2. data-only scripts:**
112+
They don't produce a complete HTML page, but only pieces of data that will be inserted one after the other into the calling page using JavaScript. If script output is going to be inserted piece by piece into the HTML DOM of the calling page, then a special query item should be inserted into the script URL.
115113

116114
Example: ```http://local-pseudodomain/perl/counter.pl?target=script-results```
117115

118116
The ```target``` query item should point to a valid HTML DOM element. It is removed from the query string before the script is started. Every piece of script output is inserted immediately into the target DOM element of the calling page in this scenario. HTML event called ```scriptoutput``` is emitted when script output is inserted into the calling local page. This event can be binded to a JavaScript function for a variety of reasons including daisy chaining of different scripts. The calling page must not be reloaded during the script execution or no script output will be inserted.
119117

120118
Two or more long running scripts can be started within a single calling page. They will be executed independently and their output will be updated in real time using separate target DOM elements. This could be convenient for all sorts of monitoring or data conversion scripts that have to run for a long time.
121119

122-
**Note for Windows developers:** Any long running script producing output that is going to be inserted into the calling page should have ```$|=1;``` among its first lines to disable the built-in buffering of the Perl interpreter. Some Windows builds of Perl may not give any output until the script is finished when buffering is enabled.
120+
**Note for Windows developers:** Any long running data-only script should have ```$|=1;``` among its first lines to disable the built-in buffering of the Perl interpreter. Some Windows builds of Perl may not give any output until the script is finished when buffering is enabled.
123121

124-
There is no special naming convention for long running scripts. They can be called from hyperlinks or HTML forms using a full HTTP URL with the PEB pseudo-domain or a relative path. If a relative path is used, the PEB pseudo-domain will be added automatically - see section [Special URLs for Interaction with the Perl Debugger](#special-urls-for-interaction-with-the-perl-debugger). The following code is an example of a direct POST request to a local script from an HTML form:
122+
There is no special naming convention for long running scripts. They can be called from hyperlinks or HTML forms using a full HTTP URL with the PEB pseudo-domain or a relative path. If a relative path is used, the PEB pseudo-domain will be added automatically. The following code is an example of a direct POST request to a local script from an HTML form:
125123

126124
```html
127125
<form action="http://local-pseudodomain/perl/test.pl" method="post">
@@ -132,7 +130,7 @@ Compiled and tested successfully using:
132130
```
133131

134132
* **AJAX Perl scripts:**
135-
AJAX scripts executed by PEB must have the keyword ```ajax``` (case insensitive) somewhere in their pathnames so that PEB is able to distinguish between AJAX and long running scripts. An AJAX script could be named ```ajax-test.pl``` or all AJAX scripts could be placed in a folder called ```ajax-scripts``` somewhere inside the application directory - see section [Settings](#settings).
133+
Local AJAX Perl scripts executed by PEB must have the keyword ```ajax``` (case insensitive) somewhere in their pathnames so that PEB is able to distinguish between AJAX and long running scripts. An AJAX script could be named ```ajax-test.pl``` or all AJAX scripts could be placed in a folder called ```ajax-scripts``` somewhere inside the application directory - see section [Settings](#settings).
136134

137135
The following example based on [jQuery](https://jquery.com/) calls a local AJAX Perl script and inserts its output into the ```ajax-results``` HTML DOM element of the calling page:
138136

@@ -151,7 +149,7 @@ Compiled and tested successfully using:
151149
});
152150
```
153151

154-
## Calling Linux Superuser Scripts
152+
## Calling Linux Superuser Perl Scripts
155153
Linux superuser Perl scripts can be started using the special query string item ```user=root```. So if PEB finds an URL like: ```http://local-pseudodomain/perl/root-open-directory.pl?user=root```, it will call ```gksudo```, which will ask the user for the root password and start the script. Output is displayed inside PEB like the output from any other Perl script. User data is supplied to superuser Perl scripts as the first command line argument without ```STDIN``` input or ```QUERY_STRING``` environment variable like in the user-level Perl scripts.
156154

157155
## Settings

REQUIREMENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Compile-time Requirements
2-
GCC compiler and Qt 5.1 - Qt 5.5 headers (including ```QtWebKit``` headers).
3-
Later versions of Qt are unusable due to the deprecation of ```QtWebKit```.
2+
GCC compiler and Qt 5.1 - Qt 5.5 headers.
3+
Later versions of Qt could be usable if ```QtWebKit``` headers and libraries are manually added, but this approach is still not tested.
44

55
Compiled and tested successfully using:
66
* [Qt Creator 2.8.1 and Qt 5.1.1](http://download.qt.io/official_releases/qt/5.1/5.1.1/) on 32-bit Debian Linux,
@@ -18,5 +18,5 @@ Compiled and tested successfully using:
1818
* Perl 5 distribution - any Linux, Mac or Windows Perl distribution.
1919
[Strawberry Perl](http://strawberryperl.com/) PortableZIP editions are successfully used with all Windows builds of PEB.
2020
[Perlbrew](https://perlbrew.pl/) Perl distributions (5.18.4, 5.23.7) are successfully used with many Linux builds of PEB.
21-
Being unable to start scripts with administrative privileges, PEB can use, but not abuse, any system Perl on PATH.
21+
PEB can also use any Perl on PATH.
2222

src/peb.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,11 +799,9 @@ public slots:
799799

800800
QFileReader *resourceReader =
801801
new QFileReader(QString(":/html/error.html"));
802-
QString htmlErrorContents =
803-
resourceReader->fileContents;
802+
QString htmlErrorContents = resourceReader->fileContents;
804803

805-
htmlErrorContents
806-
.replace("ERROR_MESSAGE", errorMessage);
804+
htmlErrorContents.replace("ERROR_MESSAGE", errorMessage);
807805
QPage::mainFrame()->setHtml(htmlErrorContents);
808806
}
809807

0 commit comments

Comments
 (0)