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
package Mydbm;
require SDBM_File;
- require TieHash;
- @ISA = qw( TieHash );
+ require Tie::Hash;
+ @ISA = qw( Tie::Hash );
sub TIEHASH {
my $type = shift;
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";
package Mydbm;
require SDBM_File;
- require TieHash;
- @ISA = qw(TieHash);
+ require Tie::Hash;
+ @ISA = qw(Tie::Hash);
sub TIEHASH {
my $type = shift;
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";