This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Unicode-Collate to CPAN version 0.67
[perl5.git] / pod / perlbot.pod
index 61a3726..91723b7 100644 (file)
@@ -2,7 +2,7 @@
 
 perlbot - Bag'o Object Tricks (the BOT)
 
-=head1 INTRODUCTION
+=head1 DESCRIPTION
 
 The following collection of tricks and hints is intended to whet curious
 appetites about such things as the use of instance variables and the
@@ -10,7 +10,8 @@ mechanics of object and class relationships.  The reader is encouraged to
 consult relevant textbooks for discussion of Object Oriented definitions and
 methodology.  This is not intended as a tutorial for object-oriented
 programming or as a comprehensive guide to Perl's object oriented features,
-nor should it be construed as a style guide.
+nor should it be construed as a style guide.  If you're looking for tutorials,
+be sure to read L<perlboot>, L<perltoot>, and L<perltooc>.
 
 The Perl motto still holds:  There's more than one way to do it.
 
@@ -57,7 +58,7 @@ See L<CLASS CONTEXT AND THE OBJECT>.
 
 =item 7
 
-IO syntax is certainly less noisy, but it is also prone to ambiguities which
+IO syntax is certainly less noisy, but it is also prone to ambiguities that
 can cause difficult-to-find bugs.  Allow people to use the sure-thing OO
 syntax, even if you don't like it.
 
@@ -242,6 +243,9 @@ where that method is defined.
        $foo->goo;
        $foo->google;
 
+Note that C<SUPER> refers to the superclasses of the current package
+(C<Foo>), not to the superclasses of C<$self>.
+
 
 =head1 USING RELATIONSHIP WITH SDBM
 
@@ -251,8 +255,8 @@ This example demonstrates an interface for the SDBM class.  This creates a
        package Mydbm;
 
        require SDBM_File;
-       require TieHash;
-       @ISA = qw( TieHash );
+       require Tie::Hash;
+       @ISA = qw( Tie::Hash );
 
        sub TIEHASH {
            my $type = shift;
@@ -265,7 +269,7 @@ This example demonstrates an interface for the SDBM class.  This creates a
            $ref->FETCH(@_);
        }
        sub STORE {
-           my $self = shift; 
+           my $self = shift;
            if (defined $_[0]){
                my $ref = $self->{'dbm'};
                $ref->STORE(@_);
@@ -277,11 +281,11 @@ This example demonstrates an interface for the SDBM class.  This creates a
        package main;
        use Fcntl qw( O_RDWR O_CREAT );
 
-       tie %foo, Mydbm, "Sdbm", O_RDWR|O_CREAT, 0640;
+       tie %foo, "Mydbm", "Sdbm", O_RDWR|O_CREAT, 0640;
        $foo{'bar'} = 123;
        print "foo-bar = $foo{'bar'}\n";
 
-       tie %bar, Mydbm, "Sdbm2", O_RDWR|O_CREAT, 0640;
+       tie %bar, "Mydbm", "Sdbm2", O_RDWR|O_CREAT, 0640;
        $bar{'Cathy'} = 456;
        print "bar-Cathy = $bar{'Cathy'}\n";
 
@@ -404,7 +408,7 @@ This problem can be solved by using the object to define the context of the
 method.  Let the method look in the object for a reference to the data.  The
 alternative is to force the method to go hunting for the data ("Is it in my
 class, or in a subclass?  Which subclass?"), and this can be inconvenient
-and will lead to hackery.  It is better to just let the object tell the
+and will lead to hackery.  It is better just to let the object tell the
 method where that data is located.
 
        package Bar;
@@ -420,7 +424,7 @@ method where that data is located.
 
        sub enter {
                my $self = shift;
-       
+
                # Don't try to guess if we should use %Bar::fizzle
                # or %Foo::fizzle.  The object already knows which
                # we should use, so just ask it.
@@ -494,8 +498,8 @@ behavior by adding custom FETCH() and STORE() methods, if this is desired.
        package Mydbm;
 
        require SDBM_File;
-       require TieHash;
-       @ISA = qw(TieHash);
+       require Tie::Hash;
+       @ISA = qw(Tie::Hash);
 
        sub TIEHASH {
                my $type = shift;
@@ -522,6 +526,10 @@ behavior by adding custom FETCH() and STORE() methods, if this is desired.
        package main;
        use Fcntl qw( O_RDWR O_CREAT );
 
-       tie %foo, Mydbm, "adbm", O_RDWR|O_CREAT, 0640;
+       tie %foo, "Mydbm", "adbm", O_RDWR|O_CREAT, 0640;
        $foo{'bar'} = 123;
        print "foo-bar = $foo{'bar'}\n";
+
+=head1 SEE ALSO
+
+L<perlboot>, L<perltoot>, L<perltooc>.