It's all (more or less) syntactic sugar. I don't necessarily think it provides any value beyond notation. It just removes the extra noise of the curly braces. For my purposes, this is value enough. However, I figured that if I was going to add a module I might as well give it some additional functionality besides simply adding an lvalued AUTOLOAD that might make it even more generally valuable. So, I added the ability to use (or not) a bunch of helper methods that look more or less like the tied interface of a hash. Some might prefer:

$hash->clear;

to:

%$hash = ();

This class lets you do both, if you turn on the clear method--by default $hash->clear will just return the value of $hash->{clear}. That is, if you don't like the additional methods, you don't turn them on. If you like the additional methods, but you aren't real fond of the named accessors using AUTOLOAD, turn the methods and the accessors off. Still further, if something has been turned off and you still want to use the functionalty use the Class::Hash syntax or use the hash directly. I think this module just takes hashes to a new level of TMTOWTDI.

Cheers,
Sterling


Kurt Starsinic wrote:


On Aug 18, Perl Authors Upload Server wrote:


The following module was proposed for inclusion in the Module List:

 modid:       Class::Hash
 DSLIP:       adpOp
 description: An object-orient wrapper for hashes.
 userid:      HANENKAMP (Andrew Sterling Hanenkamp)
 chapterid:    6 (Data_Type_Utilities)
 communities:

 similar:
   Class::Struct

rationale:

Essentially, I've just wrapped a hash in an object-orient
interface.



How is this different from a tied hash? In what situations is it useful?

- Kurt


--


-- <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> <>< ><> Andrew Sterling Hanenkamp http://Andrew.Sterling.Hanenkamp.com/ [EMAIL PROTECTED] / [EMAIL PROTECTED]

 "When an opponent declares, 'I will not come over to your side,' I
 calmly say, 'Your child belongs to us already...What are you? You will
 pass on. Your descendants, however, now stand in the new camp. In a
 short time they will know nothing else but this new community.'"
                        -- Adolf Hitler, on public education.




Reply via email to