in reply to Re^2: overloading '0+'
in thread overloading '0+'

Your my_int-routine does not require its argument to be numified as it works directly on the object.

If you force the object to be numified by changing the argument of int to: $soldier1 + 0 (you will have to overload '+' or add fallback => 1 to the overload hash) you will see truncate being called.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James