?

Log in

No account? Create an account

Previous Entry | Next Entry

Skill, knowledge, and time

It's been a long but interesting day. Most of it was spent writing the new Architechies guestbook script. (As you can tell, I asked some friends to put in a few entries; anyone I know is welcome to add an entry too. "Tatiana", btw, is really my sister Devonie, who was born in the same hospital I was, twenty minutes from here.) This script replicates one of my first major CGI projects, the (real) Lauren Royal guestbook.

The original guestbook was quite a project for me. It was two scripts, adding up to a total of 153 lines. Data storage was in a null-delimited file (non-geeks: the different pieces of data were separated by special characters). This file has been corrupted a few times in its life, mostly due to FTP mishaps, and a few entries have been lost--along with several hours spent manually editing the file. I cringe to think what might happen if someone entered a foreign character into it. I kludged something together to strip HTML out and preserve newlines, but it's not exactly something I like to think about over dinner. There's no duplicate entry handling.

The new guestbook is a single 97 line script. Well, not exactly--it's an Embperl script, which means that the HTML drives the page, not the Perl. It's backed by a MySQL database--that's industrial-strength. It recognizes six Asian encodings (all your encoding really are belong to us), along with three Unicode encodings and plain old ASCII. It converts characters to HTML entities when it needs to, and preserves spacing and newlines. It tries to stop the user from accidentally doubling an entry by setting a session variable--and if they do manage to get two entries into the database, the SELECT statement is designed to only display one of them. Essentially, it's a minor masterpiece.

Incidentally, it's also a good deal prettier, and it's built to easily handle multiple sites.

What amazes me is how far I've come in five years. This would have been beyond my capabilites then, but now it takes less than a day to perfect. This is partially because of the tools--Perl didn't have Unicode support, Embperl barely existed, Apache was still in 1.3. But mostly this is the result of my own increased skill. Astounding.

That's not to say that I don't have a long way to go. My commenting habits are atrocious ("if it was hard to write, it should be hard to understand!"), I often don't think far enough ahead, and I have a tendency to shotgun debug. And Perl is by far my best language largely because I'm not very good at anything else. At least I've finally broken my horrible habit of rolling my own solutions when people have already written and debugged better ones.

But still...flat files to SQL, HTML bugs to foreign encoding bugs, render.pl to mod_perl. Damn.