|
|
sybperl-l Archive
Up Prev Next
From: "Sabherwal, Balvinder (MBS)" <Balvinder dot Sabherwal at mortgagefamily dot com>
Subject: RE: Sybperl Vs Shell Scripts
Date: May 7 2002 8:16PM
Thanks All for your inputs.
-----Original Message-----
From: Michael Peppler [mailto:mpeppler@peppler.org]
Sent: Tuesday, May 07, 2002 3: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 [mailto:mpeppler@peppler.org]
> 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
I
> > need to make a compelling argument to use perl instead of shell
scripts.
> >>> 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.
HTH.
Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler@peppler.org *or* mpeppler@mbay.net
http://www.mbay.net/~mpeppler
International Sybase User Group: http://www.isug.com
|