X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlboot.pod;h=cf8e51843ae2c6be8d3656a227209fc76d7d7bf7;hb=18fd877aa5c85a3f8bdc7cb30b117cf8f0fe97a6;hp=d41d12ecb57a221f8ecb53544876ec3cd3eaaf1a;hpb=9cbc8da9aead5d699261a9192afb661bc20c3a2e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlboot.pod b/pod/perlboot.pod index d41d12e..cf8e518 100644 --- a/pod/perlboot.pod +++ b/pod/perlboot.pod @@ -504,7 +504,7 @@ reference (and thus an instance). It then constructs an argument list, as per usual. Now for the fun part: Perl takes the class in which the instance was -blessed, in this case C, and uses that calss to locate the +blessed, in this case C, and uses that class to locate the subroutine. In this case, C is found directly (without using inheritance). In the end, it is as though our initial line were written as follows: @@ -538,7 +538,7 @@ the name: Inside C, the C<@_> array contains: - (C<$horse>, "some", "unnecessary", "args") + ($horse, "some", "unnecessary", "args") so the C stores C<$horse> into C<$self>. Then, C<$self> gets de-referenced with C<$$self> as normal, yielding C<"Mr. Ed">. @@ -584,7 +584,7 @@ Now with the new C method, we can build a horse as follows: Notice we're back to a class method, so the two arguments to C are C and C. The C operator -not only blesses C<$name>, it also returns that reference. +not only blesses C<\$name>, it also returns that reference. This C method is called a "constructor". @@ -749,8 +749,8 @@ C might still mess up, and we'd have to override all of those 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: +is why it's important to have constructors do the low-level work. So, +let's redefine C: ## in Animal sub name { @@ -843,14 +843,13 @@ which results in: =head2 Summary -So, now we have class methods, constructors, instance methods, -instance data, and even accessors. But that's still just the -beginning of what Perl has to offer. We haven't even begun to talk -about accessors that double as getters and setters, destructors, -indirect object notation, subclasses that add instance data, per-class -data, overloading, "isa" and "can" tests, C class, and so -on. That's for the rest of the Perl documentation to cover. -Hopefully, this gets you started, though. +So, now we have class methods, constructors, instance methods, instance +data, and even accessors. But that's still just the beginning of what +Perl has to offer. We haven't even begun to talk about accessors that +double as getters and setters, destructors, indirect object notation, +overloading, "isa" and "can" tests, the C class, and so on. +That's for the rest of the Perl documentation to cover. Hopefully, this +gets you started, though. =head1 SEE ALSO @@ -867,10 +866,14 @@ Class::MethodMaker and Tie::SecureHash =head1 COPYRIGHT Copyright (c) 1999, 2000 by Randal L. Schwartz and Stonehenge -Consulting Services, Inc. Permission is hereby granted to distribute -this document intact with the Perl distribution, and in accordance -with the licenses of the Perl distribution; derived documents must -include this copyright notice intact. +Consulting Services, Inc. + +Copyright (c) 2009 by Michael F. Witten. + +Permission is hereby granted to distribute this document intact with +the Perl distribution, and in accordance with the licenses of the Perl +distribution; derived documents must include this copyright notice +intact. Portions of this text have been derived from Perl Training materials originally appearing in the I