in reply to $! context behavior
package SampleOverload; use overload '""' => \&as_string; use overload '0+' => \&as_num; sub new { bless { str => "foo", num => 1 }, shift; } sub as_string { shift()->{str}; } sub as_num { shift()->{num}; }
Interesting examples of modules using overload is y2k and Dunce::time, that magically fixes y2k or 10-digit time problem.
--
Tatsuhiko Miyagawa
miyagawa@cpan.org
|
|---|