BUU has asked for the wisdom of the Perl Monks concerning the following question:

The title is kind of misleading, but eh, I couldn't think of a better one. Anyways, I'm looking at a situation where I have a perl script that other people will be using. This script absolutely requires atleast some form of database. Doesn't have to be very fancy, but needs some form.

Now these people using my script don't have a database. And they can't install a database, lacking any form of shell access to the server that will be running the script. Infact, the only access they have is ftp (think webhosting).

So my question is, what is the best way to hooke these people up with a database that my script can actually use, but that they can install with their horridly limited access rights/abilities?

I've looked at the various perl modules, notable DBD::CSV and DBD::SQLite, but both of these rely on XS code and I'm somewhat hesitant about using this, since I seriously doubt my end users will be able to compile their own xs modules, my options are basically to provide precompiled binaries of these. I have very little experience with compiling modules that need xs files, and I have to wonder as to how binary compatible various linxes and so on are. How many different precompiled binaries would I need to provide? A seperate tree for 5.6 and 5.8? And so on and so forth. So I'm not too sure about the feasibility of these modules.

Note that I'm not really all that concerned with the speed of these modules. Obviously faster is better, but I doubt if the end users don't have atleast a basic database (mysql or something) then they would really need that fast of a script, and if they can complain I have an easy out.. (go get a real database if you want speed!)

Anyone have any positive experiences they can share from the above modules, or just compiling binary modules in general?

Update: I recently found this nice module: DBD::Sprite which appears to contain absolutely no XS code (yay!) but still implement most of the SQL language. But I've never ever heard any references to anyone even thinking of using this module, so I have no clue how reliable it is. Worth a try though!
  • Comment on Best user installable database for perl

Replies are listed 'Best First'.
Re: Best user installable database for perl
by Abigail-II (Bishop) on Oct 10, 2003 at 08:53 UTC
    In my opinion, you're trying to solve the wrong problem. Your real problem is the fact you are constrained. Figure out why you are constrained (perhaps because those people you are writing your programs for, aren't supposed to run their own database solutions, or at least, not with their current contract, but they may if they upgrade), and what you can do about it. (Use a different hosting service, upgrade contracts, bribe the admins with sushi, or just give them a call).

    I've been a sysadmin on a webhosting farm as well, and I can very well understand why some people just have FTP access; they are the once who bring in the least money, and should hence get an appropriate tiny share of the resources. No databases for them. I have (temporarely) disabled peoples FTP access and shutdown websites because they tried to take more resources than they should.

    I can give you just one advice: go talk to the people that provide the webhosting. Explain what you want, and negotiate. Getting shell access might not be a problem, or it may involve paying more fees. And if you don't get what you want, take your business elsewhere.

    But don't try to piss off the sysadmin. He's far more powerfull than you.

    Abigail

      I understand completely what you are saying about why people only have ftp access and so on and so forth.

      But as to your advice, "I can give you just one advice: go talk to the people that provide the webhosting", am I supposed to go around to the webhost of every single person who downloads my script and say "Pretty please give this random user a real database"?

      If I was the only one using my script I would do exactly what you suggest and find a host that supports what I need for my planned functionality. But this script is going to be publically available so I'd like to make it as accessible as possible with the smallest possible requirements.
        Let me rephrase that as Let the people wanting to use your script talk to their providers.

        I don't think it's a good idea to make it easy for people to backdoor in a database on a shared server they have limited access to. Sure, it's not you who does the actual uploading, but if people are going to use your program, it's not going to make you or Perl popular with the hosting people.

        Abigail

        am I supposed to go around to the webhost of every single person who downloads my script
        They are supposed to spend five bucks for a basic hosting solution. C'mon, any highschool kid can afford shared hosting on a server with CGI support and an SQL database these days just by going to McDonald's once less a month. If they're such cheapskates that they won't even spend that little money, they're not likely to be worth your headaches either.

        Makeshifts last the longest.

Re: Best user installable database for perl
by dbwiz (Curate) on Oct 10, 2003 at 07:48 UTC

    You're looking for a database driver related to DBI. Therefore you assume that DBI is already installed, otherwise you would have the same problem with it.

    Thus, if the DBI module is installed, you can also assume that they have a database driver installed. Why don't you move your application to whichever database is already available?

Re: Best user installable database for perl
by perrin (Chancellor) on Oct 10, 2003 at 05:46 UTC
    Perl comes with dbm support. You should try that first.
      Some kind of built in DB support sounds lovely, but as far as I can tell, it only supports direct key->value access, in the form of a tied hash? This might be a little tricky to implement, but I suppose it's theoretically doable..
        That's correct, dbm files are on-disk hashes. They are enough for most simple applications. If you need something fancier you can certainly try DBI::PurePerl and DBD::Sprite or DBD::CSV, but they will require CPAN downloads and installs, unlike dbm.
Re: Best user installable database for perl
by Roger (Parson) on Oct 10, 2003 at 05:09 UTC
    I thought the DBD::CSV module comes as part of the standard Perl distribution these days though.

      Nope, not even DBI is in the core (checking on perl 5.8.0, and I don't think it was included in 5.8.1). Even if DBI is there, I've had enough problems with DBD::CSV working on some machines that it'd be a problem putting it in the core.

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      Note: All code is untested, unless otherwise stated

      Roger, none of the DBD::* family (nor DBI for that matter) come as part of the core.

      -- vek --