Next Tricks of the Wizards 149

Overloading: Y2K Detection Example

        package y2k;
        use Carp;
        use overload '.'  => \&concat, 
                     '0+' => \&to_num, 
                   ;
        sub import {
          my $caller = caller;
          *{$caller . '::localtime'} = \&fake_localtime;
          *{$caller . '::gmtime'   } = \&fake_gmtime;
        }



Next Copyright © 2003 M. J. Dominus