The following module was proposed for inclusion in the Module List: modid: Tie::Hash::Sorted DSLIP: bdphp description: Presents hashes in sorted order userid: JGATCOMB (Joshua Gatcomb) chapterid: 6 (Data_Type_Utilities) communities: http://www.perlmonks.org/index.pl?node_id=289360
similar: Tie::IxHash Tie::Hash::Array Tie::SortHash rationale: The name space was chosen because Tie::SortHash already exists. I believe it is descriptive as to what the module does. Comparisons to other modules -------------------------------------------------------- Tie::IxHash 1. Preserves insertion order 2. Provides two sort routines, SortByKey & SortByValue, using textual compare Tie::Hash::Sorted 1. Order is maintained regardless of insertion order 2. Arbitrary sorting, may be changed at any time -------------------------------------------------------- Tie::SortHash 1. Uses pseudo hashes (a deprecated perl feature) 2. Uses eval("...") for sorting 3. To generate the sorted list one time: Re-sort the list as many times as there are keys Loop over the hash as many times as there are keys, stopping on match Compare current key against last key (keys^2 + keys)/2 times Slow No support for lexical variables in sorting code Inflexible calling syntax Tie::Hash::Sorted 1. Uses no deprecated perl features (tested from 5.004_3 .. 5.8.1) 2. Uses a proper code reference 3. To generate the sorted list one time: Potentially re-sort the list one time Add one to an iterator, and lookup the corresponding array element 4. Potentially slow but with opportunities for optimization 5. Supports lexicals, closures, etc 6. flexible/expandable calling syntax -------------------------------------------------------- Tie::Hash::Array 1. Sorting is by textual comparison of key name Tie::Hash::Sorted 1. Arbitrary sorting, may be changed at any time -------------------------------------------------------- I believe the module should be included because it provides functionality that the other modules do not, is flexible and expandable, and gives control to the user. Joshua Gatcomb JGATCOMB enteredby: JGATCOMB (Joshua Gatcomb) enteredon: Thu Sep 11 18:58:44 2003 GMT The resulting entry would be: Tie::Hash:: ::Sorted bdphp Presents hashes in sorted order JGATCOMB Thanks for registering, -- The PAUSE PS: The following links are only valid for module list maintainers: Registration form with editing capabilities: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=9a400000_2d17fa1c734979c0&SUBMIT_pause99_add_mod_preview=1 Immediate (one click) registration: https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=9a400000_2d17fa1c734979c0&SUBMIT_pause99_add_mod_insertit=1