Skip to content

Commit c877649

Browse files
committed
documentation update
1 parent ca415b8 commit c877649

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

README.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,19 @@ Perl Executing Browser (PEB) is an HTML GUI for [Perl 5](https://www.perl.org/)
5959

6060
## Features
6161
**Usability:**
62-
* Perl 5 scripts can be fed from HTML forms using direct GET and POST or AJAX requests to a built-in pseudo-domain.
63-
* Output from long running Perl 5 scripts can be seamlessly inserted into the HTML DOM of the calling local page.
64-
* Linux superuser Perl scripts can be started.
65-
* Any version of Perl 5 can be used.
66-
* PEB can be started from any folder.
62+
* [Perl 5 scripts can be fed from HTML forms using direct GET and POST or AJAX requests to a built-in pseudo-domain](#feeding-from-forms).
63+
* [Output from long running Perl 5 scripts can be seamlessly inserted into the HTML DOM of the calling local page](#data-only-scripts).
64+
* [Linux superuser Perl scripts can be started](#calling-linux-superuser-perl-scripts).
65+
* [Any version of Perl 5 can be used](#runtime-requirements).
66+
* [PEB can be started from any folder](#settings).
6767
* PEB is useful for both single-page or multi-page applications.
68-
* Single file or multiple files, new filename, existing or new directory can be selected by user.
69-
Their full paths are displayed in the calling local page and they can be supplied to local Perl scripts.
70-
* Browser functions are accessible from special URLs.
71-
* Any icon can be displayed on windows and message boxes.
72-
* Optional JavaScript translation of context menu and dialog boxes.
73-
* Optional warning for unsaved data in HTML forms before closing a window to prevent accidental data loss.
68+
* [Single file or multiple files, new filename, existing or new directory can be selected by user](#special-urls-for-users).
69+
Their full paths can be displayed in the calling local page and they can be supplied to local Perl scripts.
70+
* [Browser functions are accessible from special URLs](#special-urls-for-users).
71+
* [Any icon can be displayed on windows and message boxes](#icon).
72+
* [Optional context menu translation using JavaScript ](#custom-or-translated-context-menu-labels).
73+
* [Optional translation of the JavaScript *Alert*, *Confirm* and *Prompt* dialog boxes using JavaScript](#custom-or-translated-labels-for-javascript-dialog-boxes).
74+
* [Optional warning for unsaved data in HTML forms before closing a window to prevent accidental data loss](#checking-for-unsaved-user-input-before-closing-a-window).
7475
* Cross-site scripting is disabled for all web and local pages.
7576

7677
**Development goodies:**
@@ -110,7 +111,7 @@ Compiled and tested successfully using:
110111
**1. page-producing scripts:**
111112
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.
112113

113-
**2. data-only scripts:**
114+
**2. data-only scripts:**<a name="data-only-scripts"></a>
114115
They don't produce a complete HTML page, but only pieces of data that are inserted one after the other into the HTML DOM of the calling page. The special query string item ```target``` should be added to the script URL in this case.
115116

116117
Example: ```http://local-pseudodomain/perl/counter.pl?target=script-results```
@@ -121,6 +122,7 @@ Compiled and tested successfully using:
121122

122123
**Note for Windows developers:** All data-only scripts should have ```$|=1;``` among their 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.
123124

125+
<a name="feeding-from-forms"></a>
124126
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:
125127

126128
```html
@@ -176,7 +178,8 @@ PEB is designed to run from any directory without setting anything beforehand an
176178
* **Start page:**
177179
PEB can start with a static HTML start page or with a start page that is produced dynamically by a Perl script. When PEB is started, it will first try to find ```{PEB_binary_directory}/resources/app/index.html```. If this file is found, it will be used as a start page. If this file is missing, PEB will try to find ```{PEB_binary_directory}/resources/app/index.pl```. If this script is found, it will be executed and the resulting HTML output will be displayed as a start page. If both ```index.html``` and ```index.pl``` are not found, an error message will be displayed. No start page is a showstopper for PEB.
178180
Note that both static and dynamic start page pathnames are case sensitive.
179-
* **Icon:**
181+
* **Icon:**
182+
<a name="icon"></a>
180183
A PEB-based application can have its own icon and it must be located at ```{PEB_binary_directory}/resources/app/app.png```. If this file is found during application startup, it will be used as the icon of all windows and dialog boxes. If this file is not found, the default icon embedded into the resources of the browser binary will be used.
181184
* **Trusted domains:**
182185
If PEB is able to read ```{PEB_binary_directory}/resources/app/trusted-domains.json```, all domains listed in this file are considered trusted. Only the local pseudo-domain ```http://local-pseudodomain/``` is trusted if ```trusted-domains.json``` is missing. This setting should be used with care - see section [Security](#security).
@@ -187,7 +190,8 @@ PEB is designed to run from any directory without setting anything beforehand an
187190
They have two functions:
188191
**1.** to facilitate the development of fully translated and multilanguage applications by providing labels for the context menu and JavaScript dialog boxes with no dependency on compiled Qt translation files and
189192
**2.** to prevent data loss when user tries to close a local page containing unsaved data in an HTML form.
190-
* **Custom or translated context menu labels:**
193+
* **Custom or translated context menu labels:**
194+
<a name="custom-or-translated-context-menu-labels"></a>
191195
Using the following code any local HTML page can have custom labels on the default right-click context menu (if the ```contextmenu``` event is not already intercepted):
192196

193197
```javascript
@@ -206,8 +210,9 @@ They have two functions:
206210
}
207211
```
208212

209-
* **Custom or translated labels for JavaScript dialog boxes:**
210-
Using the following code any local HTML page can have custom labels on the default JavaScript Alert, Confirm and Prompt dialog boxes:
213+
* **Custom or translated labels for JavaScript dialog boxes:**
214+
<a name="custom-or-translated-labels-for-javascript-dialog-boxes"></a>
215+
Using the following code any local HTML page can have custom labels on the default JavaScript *Alert*, *Confirm* and *Prompt* dialog boxes:
211216

212217
```javascript
213218
function pebMessageBoxElements() {
@@ -295,9 +300,6 @@ They have two functions:
295300
The pseudo-domain is used to call all local files and all special URLs representing browser functions.
296301
It is intercepted inside PEB and is not passed to the underlying operating system.
297302

298-
* **Close current window:** ```http://local-pseudodomain/close-window.function```
299-
Please note that the window from where this URL was called will be closed immediately without any check for unsaved user data in HTML forms. Window-closing URL was implememented to make possible asynchronous window close confirmation JavaScript routines - see section *Settings*, paragraph [Checking for unsaved user input before closing a window](#checking-for-unsaved-user-input-before-closing-a-window).
300-
301303
* **Select single file:** ```http://local-pseudodomain/open-file.function?target=DOM_element```
302304
<a name="select-single-file"></a>
303305
The full path of the selected file will be inserted in the target DOM element of the calling local page.
@@ -359,6 +361,9 @@ They have two functions:
359361
* **About PEB embedded page:** ```http://local-pseudodomain/about.function?type=browser```
360362

361363
* **About Qt dialog box:** ```http://local-pseudodomain/about.function?type=qt```
364+
365+
* **Close current window:** ```http://local-pseudodomain/close-window.function```
366+
Please note that the window from where this URL was called will be closed immediately without any check for unsaved user data in HTML forms. Window-closing URL was implememented to make possible asynchronous window close confirmation JavaScript routines - see section *Settings*, paragraph [Checking for unsaved user input before closing a window](#checking-for-unsaved-user-input-before-closing-a-window).
362367

363368
## HTML Interface for the Perl Debugger
364369
Any Perl script can be selected for debugging in an embedded HTML user interface. The debugger output is displayed together with the syntax highlighted source code of the debugged script and its modules. Syntax highlighting is achieved using [Syntax::Highlight::Engine::Kate](https://metacpan.org/release/Syntax-Highlight-Engine-Kate) CPAN module by Hans Jeuken and Gábor Szabó. Interaction with the built-in Perl debugger is an idea proposed by Valcho Nedelchev and provoked by the scarcity of graphical frontends for the Perl debugger.

0 commit comments

Comments
 (0)