Using a flat-file database in Perl
August 30, 1999
A Poor Man's Database
Huh? What's that?
You've all heard of a Poor Man's Copyright: when you come up with a great idea and you send it to yourself in the mail to prove it was your idea. Getting a real copyright can be a pain, and sometimes isn't worth the effort. A poor man's copyright doesn't have all of the benefits of a "real" one, but for the small stuff - it usually gets the job done.
When designing a website, the same sort of problem can arise, you have a project that needs a database setup, but you either don't have the money for a database package, or it's such a small database, that using a commercial package isn't worth the trouble.
Here's one such scenario: I was designing a site for two movie theaters in Georgia. They wanted their movie showtimes on their site, with a link to the movie's website, a picture, a rating, etc. I tried doing it the old fashioned HTML way, but I found that I was typing in the same information over and over, (after all, Kate Winslet is always a star of Titanic). They change the showtimes 2 or 3 times a week, so I found myself typing in that information too many times. The approximately 10 movies a week certainly didn't merit a Microsoft SQL or Oracle. So I decided to use a series of small text files as a database instead.
Perl is an interpreted language that's available on most web server packages. It's not platform or operating system dependent, and it's easy to learn and use.
OK-This is a great idea. What do I need?
The recipe calls for 2 cups of sugar, 2 ounces of chocolate and...