[LON-CAPA-cvs] cvs: newloncapa /types HashIterator.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 10 Apr 2003 14:29:19 -0000
albertel Thu Apr 10 10:29:19 2003 EDT
Modified files:
/newloncapa/types HashIterator.pm
Log:
- significantly faster
Index: newloncapa/types/HashIterator.pm
diff -u newloncapa/types/HashIterator.pm:1.3 newloncapa/types/HashIterator.pm:1.4
--- newloncapa/types/HashIterator.pm:1.3 Thu Apr 10 10:27:00 2003
+++ newloncapa/types/HashIterator.pm Thu Apr 10 10:29:19 2003
@@ -71,8 +71,7 @@
sub new {
my $class = shift; # Class name...
my $hashref = shift; # Maintain this hash.
- my %hash = %{$hashref};
- my @keylist = keys(%hash);
+ my @keylist = keys(%$hashref);
my $keyref= \@keylist;
my $keycount = scalar @keylist;
@@ -131,9 +130,7 @@
return undef;
}
my $hashref = $self->{Hash};
- my $keysref = $self->{Keylist};
- my @keys = @$keysref;
- my $key = $keys[$self->{Index}];
+ my $key = $self->{Keylist}->[$self->{Index}];
return $$hashref{$key};
}