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

Could someone recommend really simple and convenient Perl database for website?(no MySQL, no any other SSI etc; highly customizable - GPL/freeware

Replies are listed 'Best First'.
Re: Perl database
by b10m (Vicar) on Apr 14, 2004 at 10:31 UTC

    Well, since you don't want to use MySQL, I take it you don't want PostgreSQL neither. Have a look at the speed demon called SQLite (and cpan://SQLite)

    --
    b10m

    All code is usually tested, but rarely trusted.
Re: Perl database
by castaway (Parson) on Apr 14, 2004 at 11:02 UTC
    DBD::AnyData, using XML? The most convenient, run everywhere solution, is going to be flat files of your own making. You can use XML and DBD::AnyData to simulate a database..

    C.

Re: Perl database
by matija (Priest) on Apr 14, 2004 at 10:40 UTC
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Perl database
by Anonymous Monk on Apr 14, 2004 at 19:36 UTC
    Perhaps you are looking for a NDBM_File or DB_File database. basically is allows one to create a file to store a simple hashed array. I would suggest reading up on the tie function and the documentation for the AnyDBM_File module.
    use NBDM_File; tie %hash, '/some/path/databasefile', 1, 0; $hash{'key'} = 'value'; my $value = $hash{'key'}; untie %hash;
    Although tie is pretty good for simple hashes, it does not store complex objects. In order to do that you can simply use a FreezeThaw to change between a complex memory structure and a string. So something like this...
    use FreezeThaw qw/freeze thaw/; # Store information my $cdobject = { 'title' => 'My Music', 'author' => 'Me', 'tracks' => [ {'title' => 'songA', 'length' => '1:00'}, {'title' => 'songB', 'length' => '1:50'} ] }; my $cdfrozen = freeze($cdobject); $hash{ $cdobject->{'title'} } = $cdfrozen. # Retrieve information my $cd = thaw( $hash{'My Music'} ); printf "Album %s with %s tracks\n", $cd->{'title'}, $#{$cd->{'tracks'}};
    Then, of course, you can get fancy. Like setting up a different hash for each index you want. And in order to keep the data 'synchronized' you can have the index hashes point to an entry ID with a master hash storing each entry ID mapped to a frozen object. Or better yet, even roll your own Perl module that will do all the management of the index databases and the main database for you and just have a simple object oriented interface to work with the information. However at that point you have basically written your own RDBMS and might as well setup MySQL or PostgreSQL.
      I just realized my tie statement was wrong.
      tie %hash, 'NDBM_File', '/some/path/databasefile', 1, 0;
      Aaaaah, much better.