After Pseudohashes

package Foo;

use fields qw( foo bar );

sub new {
    my $class	 = shift;
    my Foo $self = fields::new( ref($class) || $class );

    $self->{foo} = 10;
    $self->{bar} = 20;
    return $self;
}

package main;

my Foo $var = Foo->new;

$var->{foo} = 42;

print $var->{Foo}; # this will generate a compile-time error