Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

SQL etc

Posted Aug 30, 1999

Using a flat-file database in Perl

By Jason Shindler

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.

Why Perl?

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...

  • 1 web server with FTP access: It must have CGI and Perl capabilities (most modern web servers do). A "small business" account from an ISP will generally work, Geocities, Tripod or Angelfire accounts will not; they don't have CGI access. A note about Windows NT IIS servers -- your server's administrator may need to add the Perl language to the server. A free copy can be downloaded from ActiveState Tool Corp
  • 1 copy of WS-FTP, or another FTP program that supports CHMOD. All scripts will need to be set to "7-5-5" which means you should check all boxes in the owner column, and the read and execute box in the group and other columns.
  • 1 copy of CGI-LIB.PL. This is a Perl library that will make your HTML forms useable in a Perl Script.
  • Knowledge of a programming language: You don't need to know Perl, but this article assumes that you know variables and loops and other common programming concepts.
  • Know where the Perl program is located on your web server. Also know the path to your documents. A quick email to your system operator should get you these pieces of information. Still not sure? There's more information about this later on in this article. A note about Windows NT IIS servers -- on a properly configured NT server, knowing where Perl is located is not necessary

SQL etc Archives

Latest Forum Threads
SQL etc Forum
Topic By Replies Updated
MySQL rollback UAL225 0 August 21st, 09:56 PM
Complex Search Query Galway 0 May 20th, 10:04 PM
change collation at once supercain 2 May 15th, 06:18 AM
SQL Features, tools and utilities question Neomite 1 April 10th, 09:13 AM