in reply to Should I use Fields, InsideOuts, or Properties?
A couple of options:
use Internals qw(SetReadOnly);; $fred = bless {},'fred';; @$fred{ qw[ jack john bill ] } = ();; SetReadOnly $fred;; print Dumper $fred;; $VAR1 = bless( { 'john' => undef, 'jack' => undef, 'bill' => undef }, 'fred' ); $fred->{bill} = 3;; print Dumper $fred;; $VAR1 = bless( { 'john' => undef, 'jack' => undef, 'bill' => 3 }, 'fred' ); $fred->{derf} = 'error';; Attempt to access disallowed key 'derf' in a restricted hash at (eval +11) line 1, <STDIN> line 9. print Dumper $fred;; $VAR1 = bless( { 'john' => undef, 'jack' => undef, 'bill' => 3 }, 'fred' );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Should I use Fields, InsideOuts, or Properties?
by nothingmuch (Priest) on Jul 06, 2005 at 15:31 UTC | |
Re^2: Should I use Fields, InsideOuts, or Properties?
by tphyahoo (Vicar) on Jul 06, 2005 at 11:27 UTC | |
by BrowserUk (Patriarch) on Jul 06, 2005 at 12:01 UTC |