array access at compile time.
The related C<base> pragma will combine fields from base classes and any
-fields declared using the C<fields> pragma. This enables fields
+fields declared using the C<fields> pragma. This enables field
inheritance to work properly.
Field names that start with an underscore character are made private to
sub new {
my Critter::Sounds $self = shift;
- $self = fields::new($class) unless ref $self;
+ $self = fields::new($self) unless ref $self;
$self->{cat} = 'meow'; # scalar element
- @$self->{'dog','bird'} = ('bark','tweet'); # slice
+ @$self{'dog','bird'} = ('bark','tweet'); # slice
return $self;
}