Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: How could I check if a variable is 'read-only'?

by Anonymous Monk
on Jun 14, 2019 at 23:50 UTC ( [id://11101371]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    
    ...
    my $data = decode_json('{ "val":false }');
    print "readonly: ", readonly($data->{val}) ? 'yes' : 'no', "\n";
    bless $data->{val};
    
  2. or download this
    $./try
    readonly: no
    Modification of a read-only value attempted at ./try line 10.
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-29 08:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found