X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlobj.pod;h=53009c5eb2566228b4160a62d2a9dc76b4547131;hb=5ad8ef521b3ffc4e6bbbb9941bc4940d442b56b2;hp=21073a795aa737da9b6d1ee2522e61e965c9638f;hpb=14218588221b08417dacfb8f157681c6b381b73f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlobj.pod b/pod/perlobj.pod index 21073a7..53009c5 100644 --- a/pod/perlobj.pod +++ b/pod/perlobj.pod @@ -96,8 +96,8 @@ so that your constructors may be inherited: return $self; } -Or if you expect people to call not just Cnew()> but also -C<$obj-Enew()>, then use something like this. The initialize() +Or if you expect people to call not just C<< CLASS->new() >> but also +C<< $obj->new() >>, then use something like this. The initialize() method used will be of whatever $class we blessed the object into: @@ -168,6 +168,12 @@ the method that was intended to be called. If none of that works, Perl finally gives up and complains. +If you want to stop the AUTOLOAD inheritance say simply + + sub AUTOLOAD; + +and the call will die using the name of the sub being called. + Perl classes do method inheritance only. Data inheritance is left up to the class itself. By and large, this is not a problem in Perl, because most classes model the attributes of their object using an @@ -239,7 +245,7 @@ indirect object slot: display {find Critter "Fred"} 'Height', 'Weight'; -For C++ fans, there's also a syntax using -E notation that does exactly +For C++ fans, there's also a syntax using -> notation that does exactly the same thing. The parentheses are required if there are any arguments. $fred = Critter->find("Fred"); @@ -339,14 +345,14 @@ confusing precedence problems, as in these next two lines: Those actually parse as the very surprising: $obj->move->{FIELD}; # Well, lookee here - $ary->move->[$i]; # Didn't expect this one, eh? + $ary->move([$i]); # Didn't expect this one, eh? Rather than what you might have expected: $obj->{FIELD}->move(); # You should be so lucky. $ary[$i]->move; # Yeah, sure. -The left side of ``-E'' is not so limited, because it's an infix operator, +The left side of ``->'' is not so limited, because it's an infix operator, not a postfix operator. As if that weren't bad enough, think about this: Perl must guess Is, but the grief if it messes up just isn't worth the years of debugging it would likely take you to track such subtle bugs down. -The infix arrow notation using ``C<-E>'' doesn't suffer from either +The infix arrow notation using ``C<< -> >>'' doesn't suffer from either of these disturbing ambiguities, so we recommend you use it exclusively. =head2 Default UNIVERSAL methods @@ -542,6 +548,7 @@ destructed. Plain refs are only garbage-collected if the destruct level is greater than 0. You can test the higher levels of global destruction by setting the PERL_DESTRUCT_LEVEL environment variable, presuming C<-DDEBUGGING> was enabled during perl build time. +See L for more information. A more complete garbage collection strategy will be implemented at a future date. @@ -553,8 +560,8 @@ breaks the circularities in the self-referential structure. =head1 SEE ALSO -A kinder, gentler tutorial on object-oriented programming in Perl -can be found in L and L. You should also check -out L for other object tricks, traps, and tips, as well -as L for some style guides on constructing both modules -and classes. +A kinder, gentler tutorial on object-oriented programming in Perl can +be found in L, L and L. You should +also check out L for other object tricks, traps, and tips, as +well as L for some style guides on constructing both +modules and classes.