Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: NDBM_File won't store data

by HamNRye (Monk)
on Aug 28, 2003 at 21:27 UTC ( [id://287529]=note: print w/replies, xml ) Need Help??


in reply to Re: NDBM_File won't store data
in thread NDBM_File won't store data

The report function returns nothing. When I read the flat-file, it has aerio_sx_02_c.epsabrewster_pam.epsbbrewster_pam.eps in there. I should see keyvaluekeyvalue not just keykeykey.

I myself wrote a test function:

# testing Functions sub NDBM_test { my $date = MakeDate(); #write my %test; tie %test, "NDBM_File", 'test', O_RDWR|O_CREAT|O_EXCL, 0644; foreach $number (1...10) { $test{$number} = $date; } untie %test; #read tie %test, "NDBM_File", 'test', O_RDWR|O_EXCL, 0644; foreach $number (1...10) { print "$number: $test{$number}\n"; } untie %test; }

And it produces:

1: 20030828 2: 20030828 3: 20030828 4: 20030828 5: 20030828 6: 20030828 7: 20030828 8: 20030828 9: 20030828 10: 20030828

Here's what the flat file looks like...

2003082810200308289200308288200308287200308286200308285200308284200308 +283200308282200308281

Replies are listed 'Best First'.
Re: Re: Re: NDBM_File won't store data
by poj (Abbot) on Aug 29, 2003 at 18:20 UTC
    I'm not sure what you mean by 'the report function' or 'the flat-file', are you referring to another piece of code ? To confirm the problem is in the database, run your test code against the database thus ;
    #read tie %test, "NDBM_File", 'mtime', O_RDWR|O_EXCL, 0644; foreach (keys %test) { print "$_: $test{$_}\n"; } untie %test;
    If this shows only keys, try it with the other database 'type'.
    #read tie %test, "NDBM_File", 'type', O_RDWR|O_EXCL, 0644; foreach (keys %test) { print "$_: $test{$_}\n"; } untie %test;
    If the 'type' db is storing strings OK but the 'mtime' db is not, I give up !
    poj

      As wierd as this may sound, never use mtime with NDBM_File. I did a replace and replaced every instance of "mtime" with "index", and the program works fine.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://287529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-20 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found