This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document how to use $SIG{ALRM} and alarm()
[perl5.git] / pod / perlbot.pod
index de2207a..0f7078f 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
@@ -199,11 +199,10 @@ relationships between objects.
 
 =head1 OVERRIDING SUPERCLASS METHODS
 
-The following example demonstrates how one might override a superclass
-method and then call the method after it has been overridden.  The
-Foo::Inherit class allows the programmer to call an overridden superclass
-method without actually knowing where that method is defined.
-
+The following example demonstrates how to override a superclass method and
+then call the overridden method.  The B<SUPER> pseudo-class allows the
+programmer to call an overridden superclass method without actually knowing
+where that method is defined.
 
        package Buz;
        sub goo { print "here's the goo\n" }
@@ -216,7 +215,6 @@ method without actually knowing where that method is defined.
 
        package Foo;
        @ISA = qw( Bar Baz );
-       @Foo::Inherit::ISA = @ISA;  # Access to overridden methods.
 
        sub new {
                my $type = shift;
@@ -225,15 +223,15 @@ method without actually knowing where that method is defined.
        sub grr { print "grumble\n" }
        sub goo {
                my $self = shift;
-               $self->Foo::Inherit::goo();
+               $self->SUPER::goo();
        }
        sub mumble {
                my $self = shift;
-               $self->Foo::Inherit::mumble();
+               $self->SUPER::mumble();
        }
        sub google {
                my $self = shift;
-               $self->Foo::Inherit::google();
+               $self->SUPER::google();
        }
 
        package main;
@@ -253,8 +251,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;
@@ -279,11 +277,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";
 
@@ -496,8 +494,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;
@@ -524,6 +522,6 @@ 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";