| 1 | package y2k; | ||
| 2 | |||
| 3 | 1 | ▶ | use D'oh::Year qw(:DIE); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use vars qw($VERSION); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | $VERSION = 0.10; | |
| 8 | |||
| 9 | 1 | ▶ | sub import { |
|
Subroutine
import: called CC=1 SCAR=0.0
| |||
| 10 | 1 | my $caller = caller; | |
| 11 | { | ||
| 12 | 1 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 1 | *{$caller . '::localtime'} = \&localtime; | |
| 14 | 1 | *{$caller . '::gmtime'} = \&gmtime; | |
| 15 | } | ||
| 16 | } | ||
| 17 | |||
| 18 | =pod | ||
| 19 | |||
| 20 | =head1 NAME | ||
| 21 | |||
| 22 | y2k - A simple module to detect y2k bugs | ||
| 23 | |||
| 24 | |||
| 25 | =head1 SYNOPSIS | ||
| 26 | |||
| 27 | use y2k; | ||
| 28 | |||
| 29 | $year = (localtime)[5]; | ||
| 30 | print "19$year is a good year to die"; | ||
| 31 | |||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | Most Y2k bugs written in Perl are typically very easy to catch. This module catches | ||
| 36 | them. The idea is simple, it provides its own loaded versions of localtime() | ||
| 37 | and gmtime() which return trick years. If this year is used in a manner which is | ||
| 38 | not "cross-decade compliant", your program will die with an error. | ||
| 39 | |||
| 40 | This is a thin legacy wrapper around D'oh::Year. Use that instead. | ||
| 41 | |||
| 42 | |||
| 43 | =head1 SEE ALSO | ||
| 44 | |||
| 45 | L<D'oh::Year> | ||
| 46 | |||
| 47 | |||
| 48 | =head1 AUTHOR | ||
| 49 | |||
| 50 | Michael G Schwern <schwern@pobox.com> | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 1 | return 19100; | |