X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperltoot.pod;h=c77a971b57fd8394c07ad80f5574b7451098911e;hb=2b5ab1e742ea1b1374dcea7f6f90ef5c5cf29914;hp=bfe1da2559b79c011e92cd6c11a2d1c310af8f0c;hpb=e195ec09596d2fe0e528026e48bc809e69e1165e;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perltoot.pod b/pod/perltoot.pod index bfe1da2..c77a971 100644 --- a/pod/perltoot.pod +++ b/pod/perltoot.pod @@ -89,7 +89,7 @@ the same name as the class as the constructor. =head2 Object Representation By far the most common mechanism used in Perl to represent a Pascal -record, a C struct, or a C++ class an anonymous hash. That's because a +record, a C struct, or a C++ class is an anonymous hash. That's because a hash has an arbitrary number of data fields, each conveniently accessed by an arbitrary name of your own devising. @@ -263,14 +263,13 @@ clean-up code is placed in the destructor, which must (in Perl) be called DESTROY. If constructors can have arbitrary names, then why not destructors? -Because while a constructor is explicitly called, a destructor is not, -the implication being that Perl either always knows the right time to -call a destructor, or wants to reserve the right to decide for itself. -Perl's notion of the "right time" is not well-defined currently, -which is why your destructors should not rely on when they are called. +Because while a constructor is explicitly called, a destructor is not. Destruction happens automatically via Perl's garbage collection (GC) system, which is a quick but somewhat lazy reference-based GC system. To know what to call, Perl insists that the destructor be named DESTROY. +Perl's notion of the right time to call a destructor is not well-defined +currently, which is why your destructors should not rely on when they are +called. Why is DESTROY in all caps? Perl on occasion uses purely uppercase function names as a convention to indicate that the function will @@ -316,7 +315,7 @@ be made through methods. Perl doesn't impose restrictions on who gets to use which methods. The public-versus-private distinction is by convention, not syntax. (Well, unless you use the Alias module described below in -L.) Occasionally you'll see method names beginning or ending +L.) Occasionally you'll see method names beginning or ending with an underscore or two. This marking is a convention indicating that the methods are private to that class alone and sometimes to its closest acquaintances, its immediate subclasses. But this distinction @@ -800,7 +799,7 @@ base class. If the original base class has been designed properly, then the new derived class can be used as a drop-in replacement for the old one. This means you should be able to write a program like this: - use Employee + use Employee; my $empl = Employee->new(); $empl->name("Jason"); $empl->age(23); @@ -1754,27 +1753,25 @@ L, and L. -=head1 COPYRIGHT +=head1 AUTHOR AND COPYRIGHT + +Copyright (c) 1997, 1998 Tom Christiansen +All rights reserved. + +When included as part of the Standard Version of Perl, or as part of +its complete documentation whether printed or otherwise, this work +may be distributed only under the terms of Perl's Artistic License. +Any distribution of this file or derivatives thereof I +of that package require that special arrangements be made with +copyright holder. -I I hate to have to say this, but recent unpleasant -experiences have mandated its inclusion: - - Copyright 1996 Tom Christiansen. All Rights Reserved. - -This work derives in part from the second edition of I. -Although destined for release as a manpage with the standard Perl -distribution, it is not public domain (nor is any of Perl and its docset: -publishers beware). It's expected to someday make its way into a revision -of the Camel Book. While it is copyright by me with all rights reserved, -permission is granted to freely distribute verbatim copies of this -document provided that no modifications outside of formatting be made, -and that this notice remain intact. You are permitted and encouraged to -use its code and derivatives thereof in your own source code for fun or -for profit as you see fit. But so help me, if in six months I find some -book out there with a hacked-up version of this material in it claiming to -be written by someone else, I'll tell all the world that you're a jerk. -Furthermore, your lawyer will meet my lawyer (or O'Reilly's) over lunch -to arrange for you to receive your just deserts. Count on it. +Irrespective of its distribution, all code examples in this file +are hereby placed into the public domain. You are permitted and +encouraged to use this code in your own programs for fun +or for profit as you see fit. A simple comment in the code giving +credit would be courteous but is not required. + +=head1 COPYRIGHT =head2 Acknowledgments