X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/a53d211fc419ac5ad57fec64f3d43f351aea51f3..c963f488f3513efce84f81c11cd484964e988960:/pod/perlobj.pod diff --git a/pod/perlobj.pod b/pod/perlobj.pod index 448fcfe..61e636b 100644 --- a/pod/perlobj.pod +++ b/pod/perlobj.pod @@ -131,7 +131,7 @@ documented methods on the object. Note, however, that (unlike most other OO languages) Perl does not ensure or enforce encapsulation in any way. If you want objects to actually I opaque you need to arrange for that yourself. This can -be done in a varierty of ways, including using L<"Inside-Out objects"> +be done in a variety of ways, including using L<"Inside-Out objects"> or modules from CPAN. =head3 Objects Are Blessed; Variables Are Not @@ -182,7 +182,7 @@ examined when Perl does method resolution, which we will cover later. It is possible to manually set C<@ISA>, and you may see this in older Perl code. Much older code also uses the L pragma. For new code, we recommend that you use the L pragma to declare your parents. -This pragma will take care of setting C<@ISA>. It will also load the +This pragma will take care of setting C<@ISA>. It will also load the parent classes and make sure that the package doesn't inherit from itself. @@ -232,7 +232,7 @@ object (or class name), and the right hand side is the method name. my $pod = File->new( 'perlobj.pod', $data ); $pod->save(); -The C<< -> >> syntax is also used when dereferencing a reference. It +The C<< -> >> syntax is also used when dereferencing a reference. It looks like the same operator, but these are two different operations. When you call a method, the thing on the left side of the arrow is @@ -685,10 +685,10 @@ thing as well: =head3 Indirect Object Syntax X -B +B -Perl suports another method invocation syntax called "indirect object" +Perl supports another method invocation syntax called "indirect object" notation. This syntax is called "indirect" because the method comes before the object it is being invoked on. @@ -875,7 +875,7 @@ you want to refer to do it without a package name prefix under C declaration, this code will not compile under the L pragma. -As the comment says, this is not a good way to implement accessors. +As the comment says, this is not a good way to implement accessors. It's slow and too clever by far. However, you may see this as a way to provide accessors in older Perl code. See L for recommendations on OO coding in Perl. @@ -911,7 +911,7 @@ then the error will change the value of C<$@>. Because C methods can be called at any time, you should localize any global variables you might update in your C. In particular, if you use C you should localize C<$@>, and if you -use C or backticks, you should localize C<$?>. +use C or backticks you should localize C<$?>. If you define an C in your class, then Perl will call your C to handle the C method. You can prevent this by