beautypg.com

Error handling, Syntax checking, Default action – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 15

background image

Brocade Virtual ADX OpenScript API Guide

3

53-1003243-01

Overview

1

Error handling

All OpenScript API methods return an empty list in the list context, an undefined value in the scalar
context, and nothing in the void context.

Note that a Perl program will not crash on accessing these return values in the case of an error
condition.

Syntax checking

Brocade recommends adding the following Perl statements to scripts:

use strict;

use Sub::StrictDecl;

This is to enforce stricter error and warning when checking syntax.

The OpenScript compiler can also catch unsupported functions. Alternatively, you can use the
script compile scriptname strict command. This command compiles the script with the Perl
statement “use strict;”.

Default action

In the request events, such as HTTP_REQUEST and TCP_CLIENT_DATA, a default action will be
taken if no SLB action decision is made in the event handler. The default action is the Layer 4
forward, equivalent to OS_SLB::forward.

SLB

On server selection failure.

SERVER_SELECTION_FAILURE Customize action for recovery.

Content
inspection

When payload inspection finds a
matched pattern in HTTP payload
data.
NOTE: Only triggered for the

following API function
calls:

OS_SLB::log()

OS_PAYLOAD_INSPECT::
matched_str ()

OS_PAYLOAD_INSPECT::
matched_idx ()

OS_PAYLOAD_INSPECT::
matched_replace(mstr
1, rstr1, [mstr2, rstr2,
…])

PAYLOAD_INSPECT_MATCHED Return a matched pattern.

TABLE 1

Application and protocol events in ADX scripts (Continued)

Application
or protocol

Event description

Attached script method

Use