Skip to content

Instantly share code, notes, and snippets.

@dams
Created December 22, 2010 14:01
Show Gist options
  • Save dams/751539 to your computer and use it in GitHub Desktop.
Save dams/751539 to your computer and use it in GitHub Desktop.
{
package Person::Child;
use base 'Person';
__PACKAGE__->attributes('parent');
}
my $child = Person::Child->new();
ok $child->parent($p), 'setting parent';
ok $child->name('bob'), 'setting child name';
ok $child->age(5), 'setting child age';
is $child->age, 5, 'age is ok';
is $child->parent->sex, 'male', 'age is ok';
my $child_attrs = Person::Child->get_attributes();
is_deeply $child_attrs, ['parent', 'name', 'age', 'sex'], "attributes are ok";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment