Data-Compare reviews

cpanratings
 

RSS | Module Info | Add a review of Data-Compare

Data-Compare (1.22) ***

Pros: handle hashes as well as arrays, handle nested and cyclic structure, plugins.

Cons: No cmp-like functionality (returning -1, 0, 1), slow (even slower than Array::Compare).

See also: Array::Compare, JSON/YAML/Storable.

Steven Haryanto - 2012-10-25T03:03:25 (permalink)

2 out of 2 found this review helpful. Was this review helpful to you?  Yes No

Data-Compare (0.02) ***

This is a very useful module indeed and I have no qualms whatsoever about using and recommending it despite the low rating I've given. That's the beauty of CPAN - software can have implementation "issues" but provided it's packaged and documented properly it's nice n' easy to use. But on to those niggling faults.

First, the interface. As is common practice, both a procedural interface and an OO-ish interface are provided. I don't really see *why* people like providing these OO-a-like interfaces (despite me having done this in the past too), because the objects they create don't really represent anything at all. In this case, there is just one method (if we ignore the constructor) which does *exactly* the same job as in the procedural interface. So why bother? It's not as if it's encapsulating any data, inheriting any voodoo, or hiding anything complex.

The procedural interface is nice and simple, but commits what I consider to be one of the cardinal sins - it blindly EXPORTs. This behaviour is fine for modules which are meant to be language extensions, but this isn't. Using EXPORT_OK is fine, but EXPORT should not be used.

And finally, looking at its internals, there are some inconsistencies and stylistic issues I don't like. Sometimes the module accesses data in references to hashes like '$foo->{wibble}' but in other places like '$$foo{wibble}'. And I find 'unless ... elsif' extremely hard to read. Perl has 'unless' because in some situations saying 'unless' is more natural than saying 'if not', but saying 'unless foo else bar' is unnatural and hard to parse.

David Cantrell - 2003-09-01T02:36:13 (permalink)

5 out of 7 found this review helpful. Was this review helpful to you?  Yes No