Tie::SortedHash version 1.00 =========================== INTRODUCTION This module allows you to retrieve keys/values from a hash in a sorted order. COMPARISON Q: Is this module any different from Tie::IxHash or Tie::SortHash? A: Yes, let me explain *** Tie::IxHash vs Tie::SortedHash *** 1. Preserves insertion order - maintains order regardless of insertion 2. Provides static simple sort on keys/values - provides dynamic arbitrary sort routine *** Tie::SortHash vs Tie::SortedHash *** 1. Uses psuedo hashes - uses an array 2. It uses eval string for sort - uses a code ref for sort 3. Loops (keys^2 + keys)/2 times through hash - retrieves array value 4. Inflexible calling syntax - flexible/expandable calling syntax 5. Extremely slow - provides for optimization where applicable WHAT IS THIS ABOUT POSSIBLE OPTIMIZATION? There are two circumstances when you can safley enable optimizations 1. You have a simple one-level hash 2. You have a complex hash, but the sort routine only depends on the keys/values of the root level By enabling optimization, the array that stores the sorted order will only be re-generated when a change to the hash is detected. Unfortunately, it is not possible to detect when the hash changes below the root level, and the sort routine may depend on it. WHY I WROTE IT Tie::SortHash was a perfect answer to a question on perlmonks (http://www.perlmonks.org) Unfortunately it had a lot of issues with it and attempts to contact the author went unanswered. Originally, I had intended just to correct that module, but it became nearly impossible to do that and maintain backwards compatability. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install COPYRIGHT Copyright (c) 2003 Joshua Gatcomb. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.