A tough one: A flat text DB module

They have: 51 posts

Joined: Aug 1999

Is there a module (either downloadable, either included in perl itself) that let's you create a ascii database? To add, modify and remove records, search them etc.

I've been looking for quite a while but I couldn't find it.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

You don't need a module, you can do it all yourself

Ever heard of Ultimate Guestbook? (from the makers of UBB) It uses a flat file DB.

You just need to know how the information is stored in the file, and you can make a short script to pull it out, replace it, or delete it.

If you don't mind, what would you be using this for?

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 51 posts

Joined: Aug 1999

Hehe, yeah I know that. I was just wondering if there is a module to do it easily and so I don't have to care weither a field contains \n's etc. I'll use it for YaBB 2 (second version of my BB). But I'm writing the module myself at the moment.

They have: 161 posts

Joined: Dec 1999

If you're dealing with a small amount of data, a plain ASCII file is ok, but as soon as you start getting a hundred records or so, modifications become a real hassle.

Why are you restricting yourself to a flat ASCII file, when actual database implementations do the work for you, and have better speed? DB_File, for instance, Perl's interface to Berkeley databases, is fast and efficient.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

so your actually writing a module for perl that will allow you to use a flat file DB similar to a real DB?

They have: 51 posts

Joined: Aug 1999

Max, yes I am.

And japhy. That's exactly the reason why I'm writing this module. You know that not much hosts (and certainly not free ones) allow mysql databases. So flat text databases are necissary for that group. And to make the program compatible with sql too, you only have to create a module with the similiar subs and change them to work with mysql or another sql server.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.