Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Readonly problems ( Scalar::Readonly::readonly )

by runrig (Abbot)
on Dec 17, 2013 at 01:47 UTC ( #1067407=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^3: Readonly problems ( Scalar::Readonly::readonly )
Select or Download Code
Replies are listed 'Best First'.
Re^4: Readonly problems ( Scalar::Readonly::readonly )
by choroba (Canon) on Dec 17, 2013 at 14:53 UTC
    Would the following also work?
    $data->{foo} = "$k";
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      $data->{foo} = "$k";
      Yes, thanks, that does work. And is one of the few otherwise "useless use of quotes" that is not actually "useless" :-)
        You can always add a comment. :-)
        لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-31 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls