ADBRITE ads links
You are here: CodeIdol.com > Perl > Intermediate Perl > Some Advanced Object Topics
Intermediate Perl
| 14.1. UNIVERSAL Methods
As we define classes, we create inheritance hierarchies through the global @ISA variables in each package. To search for a method, Perl wanders through the @ISA TRee until it finds a match or fails.
After the sear...
|
|
| 14.2. Testing Our Objects for Good Behavior
Besides providing a place for us to put universally available methods, the UNIVERSAL package comes preloaded with two very useful utility methods: isa and can. Because UNIVERSAL defines these me...
|
|
| 14.3. AUTOLOAD as a Last Resort
After Perl searches the inheritance tree and UNIVERSAL for a method, it doesn't just stop there if the search is unsuccessful. Perl repeats the search through the very same hierarchy (including UNIVER...
|
|
| 14.4. Using AUTOLOAD for Accessors
Chapter 12 showed how to create color and set_color to get and set the color of an animal. If we had 20 attributes instead of 1 or 2, the code would be painfully repetitive. However, using an AUTOLOAD metho...
|
|
| 14.5. Creating Getters and Setters More Easily
If all that coding for creating
accessors using AUTOLOAD looks messy, rest assured that we really don't need to tackle it, because there's a CPAN module that does it a bit more directly...
|
|
| 14.6. Multiple Inheritance
How does Perl wander through the @ISA TRee? The answer may be simple or complex. If we don't have multiple inheritance
(that is, if no @ISA has more than one element), it is simple: Perl simply goes from one ...
|
|
| 14.7. Exercises
You can find the answers to these exercises in "Answers for Chapter 14" in the Appendix.
14.7.1. Exercise 1 [20 min]
Write a module named MyDate that has an AUTOLOAD method that handles the calls to the methods named day, month...
|
|
You are here: CodeIdol.com > Perl > Intermediate Perl > Some Advanced Object Topics
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|