Sample Collection Guide > How to Use an External Interpreter

How to Use an External Interpreter

In order to use external interpreters in the Automation Engine, you have to configure the relevant system variables and use the script element appropriate. The following document describes this using the example of the Perl programming language.

Define an External Interpreter

An external interpreter can be defined in the following variables in client 0000:

These interpreters are available to all clients.

The image below shows the UC_EXT_INTERPRETERS_WINDOWS and _UNIX system variables respectively (in the front UC_EXT_INTERPRETERS_UNIX, Variable tab):

 

Invoke an External Interpreter

The following example invokes a piece of Perl script using the PERL interpreter (use in the Process tab of a Job object):

:BEGIN_EXT_INT PERL

 

  printf("*** Hello World from Perl! *** \n");

  @files = qx|dir c:\\*.txt |;

  print @files;

 

:END_EXT_INT PERL

The above script results in a call like the following:

perl {Path to agent directory}\Resources\{client number}\{runid}\{runid}_0001.pl

where the Perl file {runid}_0001.pl contains the content of the script block.

If multiple :BEGIN_EXT_INT blocks are used, the number counter will differentiate the generated files.

Comments

Automic script variables can be mixed with native script.

Make sure you copy the Include objects REGISTER_VARIABLE.WINDOWS and REGISTER_VARIABLE.UNIX from the system client's REGISTER folder into the same folder in any other client of the AE system, before you adapt them to your needs.
Explanation:
After delivery of new initial data by Automic, these Include objects in the system client will be overwritten with the default data.

Return a Variable

Define the external interpreter scripts in the system variables REGISTER_VARIABLE.WINDOWS and REGISTER_VARIABLE.UNIX (Job Includes) respectively.

Inside a :BEGIN_EXT_INT and :END_EXT_INT block, the script statement :REGISTER_VARIABLE will report a string value back to an Automic variable in AE.
Then, any script following the block can use that variable.

Example

:REGISTER_VARIABLE"Perl", "Hello World from Perl!"

This does work, if you define the external interpreter and the variable in the Process tab of a Job object.

However, should you use a script attached as binary to a Storage object, a variable configured using :REGISTER_VARIABLE would not be usable by the AE system, as the script binary will be transferred to the agent directly.

 

See also: