package Person;
$schema = {
fields => {
string => [ qw(name profession) ],
int => [ qw(age) ],
ref => [ qw(father) ],
}
};
####
my $father = new Person(name => "Charlie Vilain", age => 49,
profession => "DMS II Guru");
my $self = new Person(name => "Sam Vilain", age => 22,
profession => "Perl weenie",
father => $father);
print "My name is... " . $self->name() . "\n";
$self->name("Samuel"); # ok, sets name to "Samuel"
$self->age("old"); # croaks, age is an int
$self->father("Darth"); # croaks, "Darth" is not a blessed object
print $self->mother(); # croaks, "mother" not recorded in schema
####
srand 3.14159; print join("",
sort{rand 1<0.5}map{$_^"\037"}split m{
}x,"qmptk|z~wOzm??l]pUqx^k?j"),",\n";