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

Hi, I have a DB_file which I am writing strings to. I have noticed that it stops working if I try to write an entry with more than 620 characters.
tie %hash, "DB_File", $user_db, O_RDWR; $hash{$email} = $user_data; untie %hash;
it only updates $user_db if $user_data is less than or equal to 620 chars in length. Any ideas how I could fix this would be most appreciated as need to store longer strings! Thanks!!

Replies are listed 'Best First'.
Re: DB_File limited to values 620 chars in length
by PodMaster (Abbot) on Nov 05, 2004 at 15:00 UTC
    That sounds fishy, but if you are indeed experiencing that, upgrade both DB_File and db
    use DB_File; warn $DB_File::VERSION; warn $DB_File::db_version; die $DB_File::db_ver; __END__ 1.810 at - line 2. 4.2 at - line 3. 4.002052 at - line 4.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: DB_File
by trammell (Priest) on Nov 05, 2004 at 15:25 UTC
    I'm unable to duplicate your problem, running DB_File v1.75 on Debian stable:
    #!/usr/bin/perl -w use strict; use DB_File; use Fcntl; unlink 'data.db'; tie my %hash, 'DB_File', 'data.db', O_RDWR|O_CREAT; foreach my $size (100, 200, 500, 900, 1000) { my $k = 'k' x $size; my $v = 'v' x $size; $hash{ $k } = $v; } untie %hash;
    #!/usr/bin/perl -w use strict; use DB_File; use Fcntl; print "using version: $DB_File::VERSION\n"; tie my %hash, 'DB_File', 'data.db'; foreach my $k (sort keys %hash) { printf "%d => %d\n", length($k), length($hash{$k}); }