http://www.perlmonks.org?node_id=1067407


in reply to Re^2: Readonly problems ( Scalar::Readonly::readonly )
in thread Readonly problems

Thanks, I don't really want to use readonly() though, I was just tracking down a bug involving DBI/DBD::Oracle. I tracked it down to code that went something like:
my $data = {}; my $sth = $dbh->prepare($sql); $sth->bind_param_inout(':foo' => \$data->{foo}, 10); while ( my ($k, $v) = each %hash ) { $data->{foo} = $k; $sth->execute(); }
And I got a 'modification of readonly value' error on the execute. Workaround is to modify the 'readonly' value before the execute with something like:
$k .= '';
Update: And for now, that whole thing needs a reset every few iterations, as execute() leaks memory with inout parameters.

Update2: And the previously mentioned 'leak' has been fixed in the latest release.