Skip to content

Commit 9deddc2

Browse files
committed
documentation update
1 parent d202fc6 commit 9deddc2

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

CREDITS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ http://doc.qt.io/qt-4.8/qinputdialog.html
9696
http://doc.qt.io/qt-5/qtwebkitexamples-webkitwidgets-fancybrowser-example.html (defunct)
9797
http://doc.qt.io/qt-5/qtglobal.html
9898
http://doc.qt.io/qt-5/qmake-test-function-reference.html#packagesexist-packages
99+
http://doc.qt.io/qt-5/qhash.html
100+
http://doc.qt.io/qt-5/qhash-iterator.html
99101
http://doc.qt.io/archives/qt-5.5/qwebview.html
100102
http://doc.qt.io/archives/qt-5.5/qurlquery.html
101103

@@ -189,6 +191,7 @@ http://stackoverflow.com/questions/17512542/getting-multiple-inputs-from-qinputd
189191
http://stackoverflow.com/questions/3846887/how-to-get-the-mime-type-of-a-file-in-qt
190192
http://stackoverflow.com/questions/25254043/is-it-possible-to-compare-ifdef-values-for-conditional-use
191193
http://stackoverflow.com/questions/10701504/command-working-in-terminal-but-not-via-qprocess
194+
http://stackoverflow.com/questions/17680207/qhash-iterator-example-no-match-for-operator
192195

193196
http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=176&key=QStringtoQStringList
194197
http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=598&key=QWebViewCustomContextMenu

README.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ They can not receive any user input once they are started and are divided into t
184184
```
185185

186186
## Interactive Perl Scripts
187-
PEB interactive Perl scripts have their own event loops waiting constantly for new data on STDIN and that allows them to have bidirectional connection with PEB. There can be many interactive scripts per browser window, but each of them must have an unique file name. Interactive scripts must be started with the special pseudo-user ``interactive`` and with the query string items ``target``, ``close_command`` and ``close_confirmation``.
187+
Each PEB interactive Perl script has its own event loop waiting constantly for new data on STDIN effectively creating a bidirectional connection with PEB. Many interactive scripts can be started simultaneously in one browser window. One script may be started in many instances, but each of them must have an unique identifier in the form of an URL pseudo-password. Interactive scripts must be started with the special pseudo-user ``interactive`` and with the query string items ``target``, ``close_command`` and ``close_confirmation``.
188188

189-
The pseudo-user ``interactive`` is the token used by PEB to detect interactive scripts.
189+
The URL pseudo-user ``interactive`` is the token used by PEB to detect interactive scripts.
190190

191191
The ``target`` query string item should point to a valid HTML DOM element or to a valid JavaScript function. Every piece of script output is inserted immediately into the target DOM element of the calling page or passed to the specified JavaScript function as its first and only function argument. The calling page must not be reloaded during the script execution or no script output will be inserted.
192192

@@ -203,7 +203,7 @@ document.addEventListener("DOMContentLoaded", function(event) {
203203
close_confirmation: "_closed_"
204204
}
205205
request.open('GET', 'http://interactive@local-pseudodomain/perl/interactive-script.pl' +
206-
formatParameters(parameters), true);
206+
formatParameters(parameters), true);
207207
request.send();
208208
});
209209

@@ -217,6 +217,41 @@ function formatParameters(parameters) {
217217
}
218218
```
219219

220+
The following JavaScript code demonstrates how to start one script in two instances immediately after the calling HTML page is loaded:
221+
222+
```javascript
223+
document.addEventListener("DOMContentLoaded", function(event) {
224+
var scriptOneRequest = new XMLHttpRequest();
225+
var scriptOneParameters = {
226+
target: "script-one-output",
227+
close_command: "_close_",
228+
close_confirmation: "_closed_"
229+
}
230+
scriptOneRequest.open('GET', 'http://interactive:one@local-pseudodomain/perl/interactive-script.pl' +
231+
formatParameters(scriptOneParameters), true);
232+
scriptOneRequest.send();
233+
234+
var scriptTwoRequest = new XMLHttpRequest();
235+
var scriptTwoParameters = {
236+
target: "script-two-output",
237+
close_command: "_close_",
238+
close_confirmation: "_closed_"
239+
}
240+
scriptTwoRequest.open('GET', 'http://interactive:two@local-pseudodomain/perl/interactive-script.pl' +
241+
formatParameters(scriptTwoParameters), true);
242+
scriptTwoRequest.send();
243+
});
244+
245+
function formatParameters(parameters) {
246+
return "?" + Object
247+
.keys(parameters)
248+
.map(function(key){
249+
return key + "=" + parameters[key]
250+
})
251+
.join("&")
252+
}
253+
```
254+
220255
## AJAX Perl Scripts
221256
Local AJAX Perl scripts executed by PEB must have the pseudo-user ``ajax`` in their URLs so that PEB is able to distinguish between AJAX and all other scripts.
222257

0 commit comments

Comments
 (0)