use Hash::Util qw( lock_keys unlock_keys ); sub init { my $self = shift; my $args = shift; unlock_keys( %{ $self } ); my @attributes = qw( something_or_other another_something ); foreach my $field (@attributes) { $ATTRIBUTES{ $field } = 1; $self->{ $field } = $args->{ $field }; } lock_keys( %{ $self } ); return $self; }
In reply to Re^2: Death to auto-vivification
by doom
in thread Death to auto-vivification
by DrHyde
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |