#!/usr/bin/perl -w
package Tie::Hash::Test;
use Tie::Hash;
use vars qw(@ISA);
@ISA = 'Tie::StdHash';
sub TIEHASH {
my $class = shift;
my %self;
@self{@_} = (undef) x @_;
bless \%self, $class;
}
package main;
tie my %hash, 'Tie::Hash::Test', 'one', 'two', 'three';
print join(':', keys %hash), "\n";
####
one:three:two
####
#!/usr/bin/perl -w
package Tie::Hash::Test;
use Tie::Hash;
use Attribute::Handlers autotie => { __CALLER__::Test => __PACKAGE__ };
use vars qw(@ISA);
@ISA = 'Tie::StdHash';
sub TIEHASH {
my $class = shift;
my %self;
@self{@_} = (undef) x @_;
bless \%self, $class;
}
package main;
my %hash : Test('one', 'two', 'three');
print join(':', keys %hash), "\n";
####
ARRAY(0x80f551c)