[69] in Back_Bay_LISA
To perl or not to perl?
daemon@ATHENA.MIT.EDU (Adam S. Moskowitz)
Thu Nov 19 11:05:20 1992
From: Adam S. Moskowitz <adamm@inset.com>
To: bblisa@inset.com
Date: Thu, 19 Nov 92 10:25:45 EST
At the October Back Bay LISA meeting, and more so at The Cambridge
Brewing Company afterwards, there was some brief discussion of the
use of Larry Wall's perl as a sys.admin. tool. There has also been
similar discussion in sage-education@usenix.org. I would like to
start a rational discussion of perl versus the traditional tools. I
believe such a discussion is useful as it may have some (small?)
influence on future sys.admin. ``products'' (such as MajorDomo and
the back-up system from OSU). So, let me start by offering a brief
contrast:
The traditional tools (sh, sed, awk, tr, etc.) are (mostly) built
on ``the UNIX philosophy'' of ``one job, one tool.'' The advantage
is that small tools can be combined in many different ways to solve
many different problems. Another advantage is that small scripts
that use only a few small tools do not incur large start-up
overheads. However, the syntax of each of the tools is drastically
different from the others, and such lack of uniformity is both
annoying and frustrating, in that you have to remember so many
different syntaxes. [It could be argued, however, that the syntax
of a single, complex tool such as perl is no easier to learn than
the multiple syntaxes of the traditional tools.]
Perl, on the other hand, has the advantages of uniformity as well as
the ability to maintain ``state''. One of the things I often find
frustrating is the difficulty of maintaining state across pipes, and
perl avoids this problem by reducing or eliminating the need for
pipes. However, perl is large, and thus more expensive in term of
CPU time to start up for a small program. Perl is also more
difficult to extend as the source code is quite large and
complicated. Yes, you could extend it via perl scripts, but again,
that forces you to run perl to use the new tool. Using the
traditional approach, you simply write a small C program to solve
the new problem.
I think I've presented a fairly accurate comparison of the two
approaches. Yes, I'm biased, but my mind is not closed. I'd like
very much to hear others opinions.
AdamM
--
Send mail for the `bblisa' mailing list to `bblisa@inset.com'.
Mail administrative requests to `bblisa-request@inset.com'.