http://www.xs4all.nl/~hmbrand/TD.tgz

    use DBI;
    use Tie::DBD;

    my $dbh = DBI->connect ("dbi:Pg:", ...);

    tie my %hash, "Tie::DBD", $dbh;
    tie my %hash, "Tie::DBD", $dbh, "foo";

    $hash{key} = $value;  # INSERT
    $hash{key} = 3;       # UPDATE
    delete $hash{key};    # DELETE
    $value = $hash{key};  # SELECT

Please edit t/10_hash.t to do what you need to do to connect to Postgres
or Oracle. Support for MySQL, CSV, SQLite etc for later

The reasoning behind this is that I have a small machine that connects
to a database and does a lot of calculations. To `cache' calculated
results, it uses a hash, which has outgrown the available memory space,
so I tied that with "DB_File" to disk. The system however didn't give
me enough space to store that, and the database server is huge and fast

-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using 5.00307 through 5.12 and porting perl5.13.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Reply via email to