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
+21-19Lines changed: 21 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,20 +74,22 @@ Compiled and tested successfully using:
74
74
PEB recognizes two types of local Perl scripts: long running and AJAX scripts.
75
75
There is no timeout for all Perl scripts executed by PEB.
76
76
***Long running Perl scripts:**
77
-
Long running Perl scripts are expected to produce either:
78
-
**1. a complete HTML page that will replace the calling page or
79
-
**2. pieces of data that will be inserted one after the other into the calling page using JavaScript.
80
-
81
-
**1. 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.
82
-
83
-
**2. 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.
77
+
Long running Perl scripts are expected to produce either:
78
+
**1.** a complete HTML page that will replace the calling page or
79
+
**2.** pieces of data that will be inserted one after the other into the calling page using JavaScript.
80
+
81
+
**1.** 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.
82
+
83
+
**2.** 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.
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, otherwise no script output will be inserted.
86
-
88
+
87
89
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.
88
-
90
+
89
91
**Note for Windows developers:** Long running scripts producing output that is going to be inserted into the calling page should contain the line ```$|=1;``` in their beginning to diasble the built-in buffering of the Perl interpreter. Some Windows builds of Perl may not give any output until the script is finished if the buffering is enabled.
90
-
92
+
91
93
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 Users and Interaction with Files and Folders*. The following code is an example of a direct POST request to a local script from an HTML form:
92
94
93
95
```html
@@ -101,9 +103,9 @@ Compiled and tested successfully using:
101
103
***AJAX Perl scripts:**
102
104
Inside PEB AJAX scripts have two differences compared to long running scripts.
103
105
104
-
**1. PEB returns all output from an AJAX script in one piece after the script has finished with no timeout.
106
+
**1.** PEB returns all output from an AJAX script in one piece after the script has finished with no timeout.
105
107
106
-
**2. AJAX scripts 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*.
108
+
**2.** AJAX scripts 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*.
107
109
108
110
The following example calls a local AJAX Perl script and inserts it's output into the ```ajax-results``` HTML DOM element of the calling page:
109
111
@@ -179,16 +181,16 @@ JavaScript-based settings are created to facilitate the development of fully tra
The full paths of the selected files will be inserted in the target DOM element of the calling local page.
289
291
Having a target DOM element is mandatory when using this special URL.
@@ -316,9 +318,9 @@ JavaScript-based settings are created to facilitate the development of fully tra
316
318
317
319
## HTML Interface for the Perl Debugger
318
320
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 it's 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.
319
-
321
+
320
322
If the debugged script is inside the application directory of PEB (see section *Settings*), PEB assumes that this script is going to be executed by PEB and starts the Perl debugger with a clean environment like the one for all other PEB Perl scripts. If the debugged script is outside the application directory, PEB asks for any command line arguments and starts the Perl debugger with the environment of the user who started PEB.
321
-
323
+
322
324
HTML interface for the Perl debugger is not available in the Windows builds of PEB due to the very slow response of the Perl debugger executed by PEB on Windows.
323
325
324
326

0 commit comments