Perl brick

The Perl brick allows you to incorporate custom Perl code into your control script.

Perl bricks have several settings, described below. The Control Interpreter considers any content other than these settings to be custom Perl code.

Note: Control Interpreter variables use a different syntax than Perl variables, so the two do not collide.

Perl brick settings

Setting

Description

perl_binary

The location of the Perl binary to be used.

perl_options

Any command line options you want to use when running the Perl binary.

code

A read-only setting that contains the body of the Perl brick. The Control Interpreter uses this setting to embed code from one Perl brick into another.

stdout

Where to redirect stdout for the brick. By default, stdout is sent to the screen. Specifying a value for stdout overrides the stdout_base setting.

stderr

Where to redirect stderr for the brick. By default, stderr is sent to the screen. Specifying a value for stderr overrides the stderr_base setting.

Pathnames in Perl bricks

Because of the way Perl treats escape characters, control script variables that contain Windows pathnames require special handling. To use a pathname in a Perl brick, put the path in single quotation marks (<path>) with a space at the end, then write an additional Perl statement that removes the space:
my $data_dir = ‘$(consts.data_dir) ‘;
$data_dir =~ s/ $//;

Reusing Perl bricks

You can embed the code from one Perl brick inside another Perl brick. To do this, you use the following statement:
perl_brick_2 : Perl
	...other perl code...
	$(perl_brick_1.code)
	...other perl code

where perl_brick_1 is the name of the Perl brick that has the code to be embedded.