3 # First, we want to make the account associated with a Person a proper
4 # class. Call it BankAccount.
6 # This class should have two attributes, "balance", an Int that
7 # defaults to 100, and "owner", a Person object.
9 # The owner attribute should be a weak reference to prevent cycles.
11 # Copy the deposit and withdraw methods from the HasAccount role.
13 # Finally, add a read-only history attribute. This will be an ArrayRef of
14 # Int's. This should default to an empty array reference. Use Native
15 # delegation to create a method to push values onto this attribute.
17 # Use a trigger to record the _old value_ of the balance each time it
18 # changes. This means your trigger should not do anything if it is not passed
19 # an old value (this case happens when the attribute is set for the first
22 # We will now delete the HasAccount role entirely. Instead, add an
23 # "account" attribute to Person directly.
25 # This new account attribute should default to a new BankAccount
26 # object. Use delegation so that we can call Person->deposit and
27 # Person->withdraw and have it call those methods on the person's
30 # Add a BUILD method to the Person class to set the owner of the
31 # Person's bank account to $self.
38 use MooseClass::Tests;
44 MooseClass::Tests::tests06();