beautypg.com

Why openscript uses perl instead of tcl, Extensibility, Ubiquity – Brocade Virtual ADX OpenScript Programmer’s Guide (Supporting ADX v03.1.00) User Manual

Page 10

background image

2

Brocade Virtual ADX OpenScript Programmer’s Guide

53-1003244-01

Overview

1

fly. In a multipass Scripting Engine such as Perl, the initial phase involves scanning and parsing the
input script to generate an intermediate byte code representation. The final run phase executes the
generated byte code by invoking underlying machine operations associated with each node in the
parsed byte code tree.

Extensibility

Perl was selected for the OpenScript platform because it is open and modular which allows new
functionality to be added easily. In addition to the support provided by Brocade, CPAN
(Comprehensive Perl Archive Network), is one of the largest repositories of free code in the world. If
you need a particular type of functionality, chances are there are several options on the CPAN, and
there are no fees or ongoing costs for using it. While it's possible to download one or more CPAN
Perl modules and install them via a user script on a version updates, the users must do so entirely
at their own risk. We recommend using Perl Extensions that either come pre-loaded with the
Brocade Virtual ADX or approved by Brocade.

Ubiquity

Perl is one of the most heavily used scripting languages for a multitude of applications from text
processing to Apache web server traffic processing. It is easy to use, efficient and complete.
Brocade Virtual ADX-specific functionality such as server load balancing and content
transformation within Perl are exposed to the user via custom extensions that are familiar and easy
to use. The extension interface for Brocade Virtual ADX Perl modules has been designed to mirror
the functionality available on CPAN. The difference is that Brocade Virtual ADX Perl Extensions are
optimized for most common use cases and hide the backend complexity from the script writer. Perl
also has an extensive user and developer community to publish and share scripts covering popular
deployment scenarios.

Why OpenScript uses Perl instead of TCL

Besides Perl, TCL is another scripting language that is popular in the Industry and applicable for the
Brocade Virtual ADX. TCL is a well established scripting language that finds popular use in the
embedded device environment. Factors favoring TCL are familiarity, stability and extensibility. It
offers a C API to extend scripting functionality via native C code.

The primary concern with embedding TCL is performance. Like the UNIX shell, TCL is a purely
interpretive language. This means that TCL is interpreted each step along the way. Although TCL is
run with a small and efficient interpreter, Perl which is first compiled and then run via an
intermediate byte code representation is inherently faster at execution.

Table 1

describes the advantages and disadvantages to using Perl and TCL.

TABLE 1

comparison between Perl and TCL

Perl

Tcl

Advantages

Rich language features.
Rich libraries (CPAN)
Fast performance with the compile and
run module

Popular with Server Load Balancing vendors.

Disadvantages

Bulkier with a larger dependency
baggage.

Performance lags because Tcl is a pure
interpretive language.