in reply to When numeric conversion overloading goes awry.

Submit the following patch to the maintainer of Error.pm:
-exists $self->{'-value'} ? $self->{'-value'} : undef; +exists $self->{'-value'} ? $self->{'-value'} : 0;
The bug is that 0+ should always return something that is a number. Undef, as you've discovered, isn't a number.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

Replies are listed 'Best First'.
Re^2: When numeric conversion overloading goes awry.
by dmitri (Priest) on Jan 25, 2006 at 16:25 UTC
    That will technically work. Semantically, however, this may lead to problems -- I think SOAP::Serializer relies on this technique to generate unique IDs for objects. If there are two such Error objects, SOAP::Serializer may get confused. I will file a bug in Error.pm's CPAN page, however, as yours is a valid point.
      Then that's a bug in Soap::Serializer. UIDs are a well-studied space with UUID and Data::UUID simply being two modules I've personally used. That should be filed, as well.

      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?