perl
perl
SOURCE
,
RESULT
,
FOLDER
,
TIMEOUT

The perl statement executes a Perl script (program).

Parameters

This statement has four parameters:

source – Perl script (source code). Note: It is very convenient to use “pipe” delimiters for this parameter, for example `|||script|||`. This eliminates needing to worry about the delimiters that occur in the script itself.

result – Name of field or variable in which result of the script will be placed. This result is any output sent to the standard console ouptut. If this parameter is not supplied the result will be placed in the global variable ScriptResult.

folder – Folder to execute perl script in (default to current database folder)

timeout – Maximum amount of time the script will be allowed to run (in seconds). If this option is not specified you can set the default using the scripttimeout statement. If this default has never been set the default is 60 seconds.

Description

This statement executes a Perl script (program). This rather silly example prints out the current time.

    local output
    perl |||print $«A»$."\n"."«timepattern(now(),"hh:mm:ss am/pm")»" |||,output
    message output

Panorama formulas can be embedded in the script using special tags.

To embed a Panorama formula as text, use

    $«formula»$

The formulas are calculated in advance, then embedded into the source code as constants. For example, the formula `$«2*3»$` will be embedded into the program as `6`. The formula `$«upper("hello world")»$` will be embedded as `"HELLO WORLD"`.

In the case of text formulas any special characters will be encoded as necessary for a proper Perl constant. For example the formula `$«{"}»$` will be embedded as `"""`.

To embed a Panorama formula with no quotes or translation use

    ^«formula»^

The result of the formula will be embedded into the Perl source code exactly “as-is”.

See Also

- applescript -- executes an AppleScript.
- applescript( -- executes AppleScript source code and returns the result.
- blindposixscript( -- executes a POSIX shell script using NSTask and returns the process id.
- executeapplescript -- compiles and runs an AppleScript.
- executeperlscript -- executes Perl code.
- executesudounix -- executes a UNIX shell command using *sudo* (root) privileges.
- executeunix -- executes a UNIX shell command.
- perl( -- executes a perl program and returns the result (stdout).
- php -- executes a PHP script (program).
- php( -- executes a PHP program and returns the result.
- posixscript( -- executes a POSIX shell script using NSTask and returns the result.
- python -- executes a Python script (program).
- python( -- executes a python program and returns the result (stdout).
- ruby -- executes a Ruby script (program).
- ruby( -- executes a ruby program and returns the result (stdout).
- scriptbglog -- specifies a path/file for output from STDOUT from embedded programs run in the background (Perl, Ruby, Python, PHP).
- scripttimeout -- sets the maximum runtime allowed for an embedded program (AppleScript, ShellScript, Perl, Ruby or Python).
- shellscript -- executes a UNIX shell script.
- shellscript( -- executes a UNIX shell script and returns the result.
- usebashprofile -- grabs the search path from the `.Bash_profile` file in the user's home folder, so that these paths will be used by scripting languages (*Ruby, Python*, etc.).
- xcallbackurl -- performs an action in another application using the x-callback-url mechanism.

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0.