Think about it this way:
- You don't know anything about the internals of the object.
- You have been told that the object will take either:
- a list of values (in a certain order and restrictions on the values)
- a hash (with a certain set of keys and restrictions on the values)
- another object like itself
- another object similar to itself (maybe a parent class?)
In order to allow for the four completely different ways to construct the object, the object has to have four different constructors. In C++, these would four separate functions with different munged names. In Perl, we'd have one function that may (or may not) branch out into one or more helper functions. The copy constructor, for example, might call the
clone() function on the object passed in. (
clone() would be used in a similar fashion.)
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.