X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperltooc.pod;h=78b6135717136e40ef1429c1a72bb7b3e645289c;hb=029149a3a15c2ba446182d3da9b94b640c047cac;hp=2ba6b42a0bc03562a0d419f414c3290fb14ca264;hpb=d1be9408a3c14848d30728674452e191ba5fffaa;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perltooc.pod b/pod/perltooc.pod index 2ba6b42..78b6135 100644 --- a/pod/perltooc.pod +++ b/pod/perltooc.pod @@ -624,7 +624,7 @@ The astonishing thing about the Cosmos class above is that the value returned by the &bigbang "constructor" is not a reference to a blessed object at all. It's just the class's own name. A class name is, for virtually all intents and purposes, a perfectly acceptable object. -It has state, behavior, and identify, the three crucial components +It has state, behavior, and identity, the three crucial components of an object system. It even manifests inheritance, polymorphism, and encapsulation. And what more can you ask of an object? @@ -692,7 +692,7 @@ that happens to be named &spawn. print $obj3->color(); # prints "vermilion" Each of these objects' colors is now "vermilion", because that's the -meta-object's value that attribute, and these objects do not have +meta-object's value for that attribute, and these objects do not have individual color values set. Changing the attribute on one object has no effect on other objects @@ -842,7 +842,7 @@ ones. # invoked as class method or object method sub has_attribute { my($self, $attr) = @_; - my $class = ref $self if $self; + my $class = ref($self) || $self; return exists $class->{$attr}; } @@ -1294,10 +1294,6 @@ Inheritance is a powerful but subtle device, best used only after careful forethought and design. Aggregation instead of inheritance is often a better approach. -We use the hypothetical our() syntax for package variables. It works -like C, but looks like my(). It should be in this summer's -major release (5.6) of perl--we hope. - You can't use file-scoped lexicals in conjunction with the SelfLoader or the AutoLoader, because they alter the lexical scope in which the module's methods wind up getting compiled.