A.9. Answer for Chapter 10A.9.1. Exercise (Section 10.7.1)First, start the class:
Next, use a simple dbmopen to associate %STANDINGS with permanent storage: dbmopen (our %STANDINGS, "standings", 0666) or die "Cannot access standings dbm: $!"; When a new RaceHorse is named, either pull the existing standings from the database or invent zeroes for everything:
When the RaceHorse is destroyed, the standings are updated:
Finally, the instance methods are defined:
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|