Data-Miscellany

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    Like Test::More's "eq_hash()" except that this version respects
    stringification overloads. If a package overloads stringification, it
    means that it specifies how it wants to be compared. Recent versions of
    Test::More break this behaviour, so here is a working version of
    "eq_hash()". This subroutine only does the comparison; there are no test
    diagnostics or results recorded or printed anywhere.

  is_defined(SCALAR)
    A kind of "defined()" that is aware of Class::Value, which has its own
    views of what is a defined value and what isn't. The issue arose since
    Class::Value objects are supposed to be used transparently, mixed with
    normal scalar values. However, it is not possible to overload
    "definedness", and "defined()" used on a value object always returns
    true since the object reference certainly exists. However, what we want
    to know is whether the value encapsulated by the value object is
    defined. Additionally, each value class can have its own ideas of when
    its encapsulated value is defined. Therefore, Class::Value has an
    "is_defined()" method.

    This subroutine checks whether its argument is a value object and if so,
    calls the value object's "is_defined()" method. Otherwise, the normal

lib/Data/Miscellany.pm  view on Meta::CPAN

stringification overloads. If a package overloads stringification, it means
that it specifies how it wants to be compared. Recent versions of
L<Test::More> break this behaviour, so here is a working version of
C<eq_hash()>. This subroutine only does the comparison; there are no test
diagnostics or results recorded or printed anywhere.

=head2 is_defined(SCALAR)

A kind of C<defined()> that is aware of L<Class::Value>, which has its own
views of what is a defined value and what isn't. The issue arose since
L<Class::Value> objects are supposed to be used transparently, mixed with
normal scalar values. However, it is not possible to overload "definedness",
and C<defined()> used on a value object always returns true since the
object reference certainly exists. However, what we want to know is
whether the value encapsulated by the value object is defined.
Additionally, each value class can have its own ideas of when its
encapsulated value is defined. Therefore, L<Class::Value> has an
C<is_defined()> method.

This subroutine checks whether its argument is a value object and if so, calls
the value object's C<is_defined()> method. Otherwise, the normal C<defined()>



( run in 0.453 second using v1.01-cache-2.11-cpan-0a6323c29d9 )