Skip Menu |

This queue is for tickets about the LMDB_File CPAN distribution.

Report information
The Basics
Id: 95203
Status: resolved
Priority: 0/
Queue: LMDB_File

People
Owner: Nobody in particular
Requestors: henri [...] asseily.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.07



Subject: ReadMode 1 error
Date: Wed, 30 Apr 2014 11:27:03 +0100
To: bug-LMDB_File [...] rt.cpan.org
From: Henri Asseily <henri [...] asseily.com>
When setting ReadMode(1), a get($key, $value) always triggers the following error: Modification of a read-only value attempted at LMDB_File.pm line 335
Download smime.p7s
application/pkcs7-signature 2.2k

Message body not shown because it is not plain text.

How exactly are you creating the $value scalar? get() will modify the second parameter if present so it can't be a read-only value. Do you have a test case that can reproduce this? This seems to work for me: perl -E 'use strict; use LMDB_File qw(:flags :cursor_op); mkdir("junkdb"); my $env = LMDB::Env->new("junkdb", { mapsize => 100 * 1024 * 1024 * 1024, }); my $txn = $env->BeginTxn; my $DB = $txn->OpenDB({ dbname => "rofl", flags => MDB_CREATE }); $DB->ReadMode(1); $DB->put("hello","world"); $DB->get("hello", my $value); say $value' world Also, which perl version are you using? On Wed Apr 30 06:27:24 2014, henri@asseily.com wrote: Show quoted text
> When setting ReadMode(1), a get($key, $value) always triggers the > following error: > Modification of a read-only value attempted at LMDB_File.pm line 335
In the current (0.06) version and with ReadMode(1) you need to use a "fresh" variable as the second argument of ->get, because, as a safety (the memory isn't owned by perl), the variable is marked read-only by LMDB_File. So it can't be reused as-is in another ->get(...). For the next version, now in testing, the internals was reimplemented to distinguish that kind of variables and allow its reuse by get, and under some constraints (Envs with MDB_WRITEMAP and Txn !MDB_RDONLY), allow them to be writen to. El Mié Abr 30 06:27:24 2014, henri@asseily.com escribió: Show quoted text
> When setting ReadMode(1), a get($key, $value) always triggers the > following error: > Modification of a read-only value attempted at LMDB_File.pm line 335