Re: Shell script or Perl?
On Thu, Jun 12, 2003 at 06:13:05PM -0700, Steve Lamb wrote:
> On Thu, 12 Jun 2003 17:15:36 -0500
> Kirk Strauser <kirk@strauser.com> wrote:
> > Not this again, indeed. I find a lot of shell scripts
> > incomprehensible, but you seem to like them. That's OK - it's your
> > preference. Please understand that not everyone sees it the same
> > way.
>
> Uh, no, read my post where I said that for any given situation I
> prefer Perl over Shell script. I also happen to have worked with Perl
> for far too long to fall into the trap that it is easily maintainable
> or easy to write "clean" code. I worked in a shop with strict coding
> standards with Perl as our base glue language and of the three main
> Perl people (All with several years of Perl experience) we loathed to
> touch anyone else's code because of what I had described.
Please understand that some people have contrary experience, though. I
had no trouble understanding the Perl written in the last place I
worked, and to my knowledge my coworkers didn't have problems with the
code I was writing with the possible exception of some of the stranger
Perl XS stuff (we were embedding a Perl interpreter, so this was
necessary). Not everyone there was a Perl guru, either.
Our experience was that Perl code is maintainable.
> Secondly you cannot else an unless. If you ever needed to alter this
> to show something else you would have to first convert it to an if not
> and then tack on the else or elsif.
This is untrue. Did you try it? I see nothing in the perldeltas back to
5.004 to suggest that this is a recent feature.
unless (...) {} else {} is not very clear, granted, but then again I'm
sure you could find people who'll argue convincingly that if (not ...)
{} else {} is not very clear either, for exactly the same reasons. Fact
is that if you're adding new code to a program in any language you're
not guaranteed to be able to avoid editing any of the existing code. I
don't buy this objection.
> > You're entitled to your opinion. I may not reflect on my
> > experiences in any way, but you're still free to have it.
>
> My opinions, however, I can back up with examples from your own
> code. Examples which I can explain why the code is inconsistant and
> hard to read yet, in Perl, it is considered correct, accurate and
> "good". You used an idiom without even knowing it and profressed to
> not use idiomatic Perl!
Everyone uses idioms. It's part of using a language efficiently.
Learning the standard idioms is part of understanding a language.
Judging from e.g. conversations on the Subversion development list,
there are plenty of Python idioms as well, not all of which are obvious.
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
Reply to: