On Sunday 11 April 2004 04:22, Prash wrote:
>
> Hi Peeps,

Hello,

> I'm having a weird buffering problem. I'm "tie-ing" a HASH to a DBM
> and then modifying the key values. But it isn't writing to the DBM
> until I untie the HASH variable. How do I flush the buffer? I know
> the standard $| way and it ain't working. Any help would be muchly
> appreciated.
>
> If I place the tie and untie inside the loop then it works??
>
> Code:
> tie (%KSK, 'DB_File', $database) or loganddie ("Unable to open dbm
> file $database");
>
> while (<STDIN>) {
> .....
> ....
> $KSK{$user} = "lalala";
> }
>
> untie (%KSK);

According to the documentation the DB_File module has a sync method that you can use.

my $db = tie %KSK, 'DB_File', $database or loganddie( "Unable to open dbm file 
$database" );

while ( <STDIN> ) {
    .....
    ....
    $KSK{ $user } = 'lalala';

    $db->sync();
    }

untie %KSK;


John
-- 
use Perl;
program
fulfillment


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to