Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re:x2 Any Point in Uploading Tie::SortedHash (say why)

by Limbic~Region (Chancellor)
on Sep 06, 2003 at 16:24 UTC ( [id://289476]=note: print w/replies, xml ) Need Help??


in reply to Re:x2 Any Point in Uploading Tie::SortedHash (say why)
in thread Any Point in Uploading Tie::SortedHash

grinder,
I understand that importance. There is a reference to the POD to look at the README for comparison to similar modules. Here is an advanced copy of the README.
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 insertio +n 2. Provides static simple sort on keys/values - provides dynamic arbi +trary 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. Unfortuna +tely, it is not possible to detect when the hash changes below the root leve +l, 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 t +he author went unanswered. Originally, I had intended just to correct that module, b +ut 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.

Cheers - L~R

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://289476]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-06-22 02:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.