Free Newsletters:
DatabaseDaily  
Database Journal
Search Database Journal:
 
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» DBA Jobs
» Sitemap

News Via RSS Feed


follow us on Twitter





Brocade Doubles Down on 16 Gbps Fibre Channel

Microsoft Wants iOS Apps to Run on WP7

Avaya Debuts New Virtual Services Switch
Database Journal |DBA Support |SQLCourse |SQLCourse2







Technical Specialist – Pre-sales (MA)
Next Step Systems
US-MA-Littleton

Justtechjobs.com Post A Job | Post A Resume

Featured Database Articles

SQL etc

August 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

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

SQL etc Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 



Latest Forum Threads
SQL etc Forum
Topic By Replies Updated
get records within same group and with condition jutiyi 3 January 12th, 03:07 PM
Database SQL help needed to check date range clashes! deadlydragon121 7 January 9th, 02:47 PM
Remove Alpha from data in Column disk244 0 November 19th, 11:13 AM
sql query releatıon record show and sub total and grand total thank you for your howerlover 0 November 18th, 01:55 AM