Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Modification of a read-only value attempted

by BillKSmith (Monsignor)
on Nov 27, 2012 at 20:50 UTC ( [id://1005915]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Modification of a read-only value attempted
in thread Modification of a read-only value attempted

This discussion reminds me of a related question. When a Readonly hash or array contains references, are the targets of those references protected? As a common example, are the elements of Readonly matrix protected?

Bill
  • Comment on Re^3: Modification of a read-only value attempted

Replies are listed 'Best First'.
Re^4: Modification of a read-only value attempted
by AnomalousMonk (Archbishop) on Nov 27, 2012 at 21:23 UTC

    Easy to test:

    >perl -wMstrict -MData::Dump -le "use Readonly; ;; Readonly my %h => (a => {b => {c => {d => 1}}}); dd \%h; ;; $h{a}{b}{d} = 2; " { # tied Readonly::Hash a => { # tied Readonly::Hash b => { # tied Readonly::Hash c => { # tied Readonly::Hash d => 1, }, }, }, } Modification of a read-only value attempted at -e line 1

    See also DESCRIPTION section of Readonly.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-19 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found