Skip to main content
Skip table of contents

PerlScript

This component is used for executing Perl Script. The Perl Script to be executed is specified using the Custom Property Sheet (CPS). This component executes the script on documents it receives as input and returns the result.

Points to note

  • The input message to the PerlScript component is provided as a command line argument to the Perl script to be executed.
  • If the input message contains white spaces, then please provide the message in courses if the whole message is required in one argument.

This component can be executed on Windows platform only.

Configuration and Testing

Interaction Configuration


Figure 1: Interaction Configurations panel in PerlScript CPS

Attributes

Pre Processing XSL Configuration

Pre Processing XSL configuration can be used to transform request message before processing it. Click the ellipses button against the property to configure the properties.

Refer to the Pre/Post Processing XSL Configuration section under the Common Configurations page for details regarding Pre Processing XSL configuration and Post Processing XSL configuration (below).

Post Processing XSL Configuration 

Post Processing XSL configuration can be used to transform the response message before sending it to the output port.

Process Message Based on Property

The property helps components to skip certain messages from processing.

Refer to the Process Message Based On a Property section under the Common Configurations page.

Read Script from file?

If enabled, Script file path property appears where you can provide the location where the script file is saved.

Script File Path

Provide the complete path of the Perl Script file (file should have .pl extension) which you want to execute.


Figure 2: Script file path property to provide the location where the script file is saved

PerlScript

If the Read Script from file ? property is disabled, populate the PerlScript property with the Perl Script.

Wait Time

The time after which the Perl script execution forecefully stops. -1 indicates an infinite time.

Perl Configuration

Click the ellipsis button to set the perl script location.

Perl Executable Path

Specify the location where the Perl script is saved.


Figure 3: Option to provide the location where the Perl script is saved

Delimiter of input parameters

The input message to the component is provided as a command line argument to the Perl script to be executed. If the incoming request has to be provided in multiple arguments, it will be split based on the delimiter provided here.

If left empty, the whole request will be sent in a single argument which can be accessed by $ARGV[0] in script.

Escape Character for Delimiter 

The input message to the component is provided as a command line argument to the Perl script to be executed. If the input request has to include delimiter part of the string, it has to be prefixed by the escape character provided here.

If "\" is used as escape character, it has to be provided as "\\" in the input.

Replace Control Characters 

 If this property is enabled, Control Characters present in the input will be replaced by a string representation of the same value during script evaluation. This is an expert property.

Cleanup resources (excluding connection) after each document

This closes all the resources except for the connection after every request. If the less processing time is more important the less memory usage, then it is recommended to disable this property and vice versa.

For more details, refer to the respective section under in the Common Configurations page.

Target Namespace

Refer to the Target Namespace section under the Common Configurations page.  

Monitoring Configuration

Please refer to the Monitoring Configuration section in Common Configurations page.

Scheduler Configuration

Please refer the respective section in Common Configurations page.

Transport Configurations

Please refer the respective section in Common Configurations page.

Transport Configurations panel will be available only if scheduling is enabled in Scheduler Configurations panel.

Error Handling

Please refer the sections Request Processing Error and Invalid Request Error in the Error Handling section of Common Configurations page for details.

Sample Input and Output

The configuration can be tested by clicking the Test button in the interaction Configuration panel.

Sample Input

Below is a sample Perl script.

PERL
$top_number = 100;
$x = 1;
$total = 0;
while ( $x <= $top_number ) {
$total = $total + $x;# short form: $total += $x;
$x += 1;# do you follow this short form?
}
print "The total from 1 to $top_number is $total\n";

Below are the sample input and the output respectively for the above script.


Figure 4: Sample Input Message

Output


Figure 5: Response Generated

Functional Demonstration

Scenario 1

Execution of Perl Script provided.

Configure the Perl Script adapter as described in Configuration and Testing section and use feeder and display component to send sample input and to check the response respectively. In the example given below, the script provided is same as in Sample Input and Output section.


Figure 6: Scenario demonstration with sample input and output

Scenario 2

This sample demonstrates accessing an input message.

Configure the component with the following script.

PERL
print $ARGV[0]; 

Figure 7: Sample Perl Script


Figure 8: Sample Input Message


Figure 9: Response Generated



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.