subroutine. In this case, C<Horse::sound> is found directly (without
using inheritance). In the end, it is as though our initial line were
written as follows:
subroutine. In this case, C<Horse::sound> is found directly (without
using inheritance). In the end, it is as though our initial line were
written as follows:
- (C<$horse>, "some", "unnecessary", "args")
+ ($horse, "some", "unnecessary", "args")
so the C<shift> stores C<$horse> into C<$self>. Then, C<$self> gets
de-referenced with C<$$self> as normal, yielding C<"Mr. Ed">.
so the C<shift> stores C<$horse> into C<$self>. Then, C<$self> gets
de-referenced with C<$$self> as normal, yielding C<"Mr. Ed">.
Notice we're back to a class method, so the two arguments to
C<Horse::named> are C<Horse> and C<Mr. Ed>. The C<bless> operator
Notice we're back to a class method, so the two arguments to
C<Horse::named> are C<Horse> and C<Mr. Ed>. The C<bless> operator
too. Therefore, it's never a good idea to define the data layout in a
way that's different from the data layout of the base classes. In fact,
it's a good idea to use blessed hash references in all cases. Also, this
too. Therefore, it's never a good idea to define the data layout in a
way that's different from the data layout of the base classes. In fact,
it's a good idea to use blessed hash references in all cases. Also, this
-is also why it's important to have constructors do the low-level work.
-So, let's redefine C<Animal>:
+is why it's important to have constructors do the low-level work. So,
+let's redefine C<Animal>: