Embperl
Not many thoughts recently. That's because I've been so busy at work that I simply haven't had the will to work on my home web pages. And yes, it is a matter of will and nothing else. There existed plenty of time to do things with my home machine and in fact I did do some homework, but anything on my list of things to do that looked like a project simply evoked a mild dread that prevented me from considering working on it.
But the holiday occurred. (Which by the way increased the workload due to the fact that as of Wednesday noon I still hadn't bought my Thanksgiving turkey.) I took half a day and elminated the top of my dire chore list.
Thanksgiving tends to be a mild holiday for me. Cook a turkey, homemade stuffing, homemade gravy, a veggie or two. Pig out when it is ready or mid-afternoon, whichever comes first.
This Thanksgiving I gave myself an early Christmas present. While doing those dire chores, I made up my mind and bought a CD ReWriter. This gave me something to do while waiting for the turkey to start producing juice for the gravy and when not talking to family on the phone.
But this was supposed to be about working on the web pages. So now that I've blathered all over the map, let's get back on topic:
I am going to like EmbPerl.
Ok, I'm an old Unix user. (Circa 1983.) I've programmed with some level of proficiency in the major Unix scripting languages, sh, csh, awk, sed, etc. (No, etc is not a programming language, it just looks like it. I hope no one ever really creates a language named etc.) Then I wrote a huge backup control program in csh which, despite the fact that it was essentially doing a preset sequence of commands, grew into a multi-thousand line, unmaintainable piece of junk.
Then came perl 4. Aaaahhhh.
A week later I had a 400 line perl script that did 70% of the job and I had redefined the task to elminate another 20%. A month later I had a 1500 line program that did 73% of the job and was looking really ugly. I was begining to wonder if I had made a mistake in choosing perl.
But I liked programming in perl. There's something nice about knowing that there is a kitchen sink available when a bathroom sink just won't do. So I started completely over. I was learning that the perl motto- "There's more than one way to do it"- also meant that my way was the wrong way most of the time.
For example, while learning perl, I would frequently get stuck on some really minor thing, and no change to the code would seem to make any change in the behavior. After a few frustrating hours, I would crack open the camel book. (O'Reily & Associates, "Programming perl" by Larry Wall and Randal L. Schwarz) Therein I would almost invariably find a perl function which does exactly what I was trying to make a huge subroutine do. I got so mystical about it that if I spent more than 10 minutes on a problem, I'd crack the camel expecting to find the answer in Chapter 4.
Back to the backup program. Two weeks of rewriting left me with 500 fairly clean lines of code that did about 95% of the backup. And the rest was human intervention required anyway. Perl was going to stay in my arsenal.
(About this time I discovered the Amanda backup program and all my work was moot, since Amanda was more flexible, more easily extensible and had fewer niggling little problems. On the other hand, Amanda is considerably more than 500 lines of code.)
So awk and sed and to a large extent the shell scripting languages went to dodo-vile for me. I started churning out 10-line, 20-line, 30-line perl scripts for everything under the sun.
I've wandered away from EmbPerl again. I guess I had other things that wanted to get expressed. But I'll close with a final thought about programming in general. It is my belief that the power of a programming language is measured by the ease with which you can do stupid, pointless things in it. Thus, EmbPerl:
[- $tim = time % 10 -]
[$ if ($tim % 2) $]
<BODY BGCOLOR="lt blue">
[$ else $]
<BODY BGCOLOR="red">
[$ endif $]
This changes that background color of a web page based on whether the time is in an odd or an even ten second block. Really pointless, very easy.