You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-37Lines changed: 39 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,25 +48,17 @@ These are the basic steps for building your first PEB-based application:
48
48
49
49
***4.** Connect your Perl scripts using a link to ``name-of-script-configuration-object.settings``.
50
50
51
-
Note that PEB is created to work from any folder without installation and all files and directories used by PEB are relational to the directory where the PEB binary is located. All your local HTML files and Perl scripts must be located inside the ``{PEB_binary_directory}/resources/app`` directory.
51
+
Note that PEB is created to work from any folder without installation and all your local HTML files and Perl scripts should be located inside the ``{PEB_binary_directory}/resources/app`` directory.
52
52
53
53
## Design Objectives
54
-
***1. Fast and easy graphical user interface for Perl 5 desktop applications:**
55
-
use Perl 5, JavaScript, HTML and CSS to create beautiful desktop applications
56
-
57
-
***2. Zero installation:**
58
-
run from any folder
59
-
60
-
***3. Cross-platform availability:**
61
-
usable on every platform where Perl 5 and Qt 5 are available
62
-
63
-
***4. Secure serverless solution:**
64
-
no server of any kind is installed or started
65
-
54
+
***1. Fast and easy and beautiful graphical user interface for Perl 5 desktop applications**
55
+
***2. Zero installation**
56
+
***3. Cross-platform availability**
57
+
***4. Secure serverless solution**
66
58
***5. Maximal reuse of existing web technologies and standards**
67
59
68
60
## Features
69
-
*[Perl script output is seamlessly inserted into the calling local page.](#perl-scripts-api)
61
+
*[Perl script output is seamlessly inserted in any local page.](#perl-scripts-api)
70
62
*[Perl scripts with STDIN event loops can be repeatedly fed with data.](#interactive-perl-scripts)
71
63
*[Any version of Perl 5 can be used.](#runtime-requirements)
72
64
* PEB can be started from any folder.
@@ -78,6 +70,7 @@ Note that PEB is created to work from any folder without installation and all fi
78
70
79
71
## Security
80
72
* PEB does not need administrative privileges, but does not refuse to use them if needed.
73
+
* PEB does not install or start any kind of server.
81
74
* PEB executes with no sandbox only local Perl 5 scripts and
82
75
users have full access to their local files.
83
76
* Cross-origin requests and cross-site scripting are disabled.
@@ -142,26 +135,32 @@ Sometimes it is important to minimize the size of the relocatable (or portable)
142
135
``compactor.pl`` relies on ``Module::ScanDeps`` and ``File::Copy::Recursive`` CPAN modules, which are located in the ``{PEB_binary_directory}/sdk/lib`` folder.
143
136
144
137
## Perl Scripts API
145
-
Every Perl script run by PEB is called by clicking a link or submitting a form to a pseudo filename composed from the name of the JavaScript object with the settings of the Perl script and a ``.settings`` extension. Perl data output is seamlessly inserted into the HTML DOM of the local page using JavaScript.
138
+
Every Perl script run by PEB is called by clicking a link or submitting a form to a pseudo filename composed from the name of the JavaScript object with the settings of the Perl script and a ``.settings`` extension.
139
+
140
+
A minimal example of a Perl script settings object and a starting link:
146
141
147
-
A minimal example of a Perl script settings object:
142
+
```html
143
+
<ahref="perl_test.settings">Start Perl script</a>
144
+
```
148
145
149
146
```javascript
150
-
varperlScriptObject= {};
151
-
perlScriptObject.path='{app}/perl/test.pl';
152
-
perlScriptObject.stdout=function (stdout) {
147
+
varperl_test= {};
148
+
perl_test.scriptFullPath='{app}/perl/test.pl';
149
+
perl_test.stdoutFunction=function (stdout) {
153
150
var container =document.getElementById('tests');
154
151
container.innerHTML= stdout;
155
152
}
156
153
```
157
154
158
-
*``path``
155
+
*``scriptFullPath``
159
156
This is the path of the Perl script that is going to be executed.
160
157
The keyword ``{app}`` will be replaced by the the full path of the application directory.
158
+
PEB does not check the file name extension or the shebang line of the supplied Perl script.
159
+
Scripts without a file name extension can also be used.
161
160
*This object property is mandatory.*
162
161
163
-
*``stdout``
164
-
The ``stdout`` object property must be a JavaScript function. Every piece of script output is passed to this function as its only argument.
162
+
*``stdoutFunction``
163
+
The ``stdoutFunction`` object property must be a JavaScript function. Every piece of script output is passed to this function as its only argument.
165
164
*This object property is mandatory.*
166
165
167
166
*``requestMethod``
@@ -191,16 +190,16 @@ perlScriptObject.stdout = function (stdout) {
191
190
}
192
191
```
193
192
194
-
*``close_command``
195
-
The ``close_command`` object property designates the command used to gracefully shut down an interactive script when the containing PEB window is going to be closed. Upon receiving it, the interactive script must start its shutdown procedure.
193
+
*``scriptExitCommand``
194
+
The ``scriptExitCommand`` object property designates the command used to gracefully shut down an interactive script when PEB is going to be closed. Upon receiving it, the interactive script must start its shutdown procedure.
196
195
197
-
*``close_confirmation``
198
-
Just before exiting an interactive script must print on STDOUT its ``close_confirmation`` to signal PEB that it completed its shutdown. All interactive scripts must exit in 3 seconds after ``close_command`` is given or any unresponsive scripts will be killed and PEB will exit.
196
+
*``scriptExitConfirmation``
197
+
Just before exiting an interactive script must print on STDOUT its ``scriptExitConfirmation`` to signal PEB that it completed its shutdown. All interactive scripts must exit in 3 seconds after ``scriptExitCommand`` is given or any unresponsive scripts will be killed and PEB will exit.
199
198
200
199
Perl scripts running for a long time should have ``$|=1;`` among their first lines to disable the built-in buffering of the Perl interpreter. Some builds of Perl may not give any output until the script is finished when buffering is enabled.
201
200
202
201
## Interactive Perl Scripts
203
-
Each PEB interactive Perl script must have its own event loop waiting constantly for new data on STDIN for a bidirectional connection with PEB. Many interactive scripts can be started simultaneously in one browser window. One script may be started in many instances provided that it has an unique JavaScript settings object with and unique ``stdout`` object property. Interactive scripts should also have the ``close_command`` and ``close_confirmation`` object properties.
202
+
Each PEB interactive Perl script must have its own event loop waiting constantly for new data on STDIN for a bidirectional connection with PEB. Many interactive scripts can be started simultaneously in one browser window. One script may be started in many instances provided that it has an unique JavaScript settings object with and unique ``stdoutFunction`` object property. Interactive scripts should also have the ``scriptExitCommand`` and ``scriptExitConfirmation`` object properties.
204
203
205
204
The following code shows how to start an interactive Perl script right after a local page is loaded:
206
205
@@ -217,14 +216,17 @@ The following code shows how to start an interactive Perl script right after a l
@@ -242,7 +244,7 @@ The following code shows how to start an interactive Perl script right after a l
242
244
The ``index.htm`` file of the demo package demonstrates how to start one script in two instances immediately after a page is loaded.
243
245
244
246
## Selecting Files and Folders
245
-
Selecting files or folders with their full paths is performed by clicking a link to a pseudo filename composed from the name of the JavaScript object with the settings of the wanted dialog and a ``.dialog`` extension. Selected files or folders are seamlessly inserted in any local page using the ``target``object property. ``target`` must be a JavaScript function which receives all selected files or folders as its only argument.
247
+
Selecting files or folders with their full paths is performed by clicking a link to a pseudo filename composed from the name of the JavaScript object with the settings of the wanted dialog and a ``.dialog`` extension. Selected files or folders are seamlessly inserted in any local page by the ``receiverFunction``taking all selected files or folders as its only argument.
// 'single-file', 'multiple-files', 'new-file-name' or 'directory'.
255
257
select_file.type='single-file';
256
-
select_file.target=function (stdout) {
257
-
var container =document.getElementById('tests');
258
-
container.innerHTML=stdout;
258
+
select_file.receiverFunction=function (file) {
259
+
var container =document.getElementById('single-file-test');
260
+
container.innerHTML=file;
259
261
}
260
262
```
261
263
@@ -298,7 +300,7 @@ my $data_directory = "$current_working_directory/resources/data";
298
300
```
299
301
300
302
## Log Files
301
-
If log files are needed for debugging of PEB or a PEB-based application, they can easily be turned on by manually creating ``{PEB_binary_directory}/logs``. If this directory is found during application startup, the browser assumes that logging is required and a separate log file is created for every browser session following the naming convention: ``{application_name}-started-at-{four_digit_year}-{month}-{day}--{hour}-{minute}-{second}.log``. PEB will not create ``{PEB_binary_directory}/logs`` on its own and if this directory is missing and no logs will be written. Please note that log files can grow rapidly and if disc space is an issue, writing log files can be turned off by simply removing or renaming ``{PEB_binary_directory}/logs``.
303
+
If log files are needed for debugging of PEB or a PEB-based application, they can easily be turned on by manually creating ``{PEB_binary_directory}/logs``. If this directory is found during application startup, the browser assumes that logging is required and a separate log file is created for every browser session following the naming convention: ``{application_name}-started-at-{four_digit_year}-{month}-{day}--{hour}-{minute}-{second}.log``. PEB will not create ``{PEB_binary_directory}/logs`` on its own and if this directory is missing no logs will be written.
These are Perl scripts that are started immediately after a local page is loaded.
323
325
324
326
*``closeConfirmation``
325
-
This is the text displayed when user has pressed the close button, but unsaved data in local HTML forms is detected. If no warning text is found, PEB assumes that no warning has to be displayed and exits immediately.
327
+
This text is displayed when the close button is pressed, but unsaved data in local HTML forms is detected. If no warning text is found, PEB exits immediately.
0 commit comments