in reply to Re^2: why the subtract result is negative when i use XML::Smart!
in thread why the subtract result is negative when i use XML::Smart!

It looks like a bug in Object::MultiType. $last_value is an XML::Smart object (which derives from Object::MultiType) and overloads subtraction. Looks like line 168 ($n -= $_[0] ;) in the sub _OVER_deinc in multitype.pm may have it backwards. Changing the last two line of the sub to:

my $temp = scalar $_[0]; return $temp - $n;

fixes the problem for this case. I can't guess what situation it may fail for though.

You should raise a bug tag against the module perhaps?

You can do that at rt://Object::MultiType


DWIM is Perl's answer to Gödel