Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Gravatt, John" <GravJo at ncs dot com>
Subject: RE: Sybperl Vs Shell Scripts
Date: May 7 2002 8:02PM

The biggest advantage sybperl has over shell (at least in my mind) is that
sybperl can maintain db connections.  This means less impact to your
dataserver and faster scripts because a db connection doesn't have to be
established for each query.


-----Original Message-----
From: Michael Peppler []
Sent: Tuesday, May 07, 2002 2:38 PM
To: SybPerl Discussion List
Subject: RE: Sybperl Vs Shell Scripts

On Tue, 2002-05-07 at 12:15, Sabherwal, Balvinder (MBS) wrote:
> -----Original Message-----
> From: Michael Peppler []
> Sent: Thursday, March 28, 2002 10:03 AM

> Sabherwal, Balvinder (MBS) writes:
>  > I am looking for some inputs from you in order to present some facts
> about
>  > the capabilities of sybperl which are lacking in shell scripts and also
>  > need to make a compelling argument to use perl instead of shell

> >>> perl scripts are much faster than shell scripts.
> How ??

shell scripts are run (and interpreted) line by line.

perl scripts are compiled to byte code, and then run. This also means
that a syntax error will, in the vast majority of cases, be caught at
compile time, where a shell script could fail half-way through due to a
missing fi (or whatever).

> >>>perl scripts allow much better error control and recovery.
> >>>sybperl (vs. isql in shell script) is *much* faster, *much* better
> >>>error control, greatly expanded usage flexibility.
> In what terms is sybperl faster than the isql in shell scripts??

sybperl won't be faster than isql at fetching data. But it's the
processing of the data that you just fetched that will be much faster
(compared to using awk, sed, etc. to parse the output of isql).

In addition, a sybperl script will (normally) not be affected by data
that is not in the expected format.

> >>>perl scripts can use eval {} to catch fatal errors in deeply nested
> >>>code and cleanly restart/retry/abort in case of errors.
> How is this different than trap in shell scripts??

trap will handle signals - it will not handle a possible SQL error in
some script. With eval {} I can use perl's die() or croak() functions to
raise an error anywhere in the script, and know exactly where this will
take me in the script's processing.


Michael Peppler                              Data Migrations, Inc.           *or*
International Sybase User Group: