For example, here's how to add a couple of extra flags to C compiler
invocations:
- sh Configure -Accflags="-DPERL_Y2KWARN -DPERL_POLLUTE_MALLOC"
+ sh Configure -Accflags="-DPERL_EXTERNAL_GLOB -DPERL_POLLUTE_MALLOC"
For more help on Configure switches, run
README.vms Perl notes for VMS
README.vos Perl notes for Stratus VOS
README.win32 Perl notes for Windows
-README.Y2K Notes about Year 2000 concerns
reentr.c Reentrant interfaces
reentr.h Reentrant interfaces
reentr.pl Reentrant interfaces
+++ /dev/null
-The following information about Perl and the year 2000 is a modified
-version of the information that can be found in the Frequently Asked
-Question (FAQ) documents.
-
-Does Perl have a year 2000 problem? Is Perl Y2K compliant?
-
-Short answer: No, Perl does not have a year 2000 problem. Yes,
- Perl is Y2K compliant (whatever that means). The
- programmers you've hired to use it, however, probably are
- not. If you want perl to complain when your programmers
- create programs with certain types of possible year 2000
- problems, a build option allows you to turn on warnings.
-
-Long answer: The question belies a true understanding of the
- issue. Perl is just as Y2K compliant as your pencil
- --no more, and no less. Can you use your pencil to write
- a non-Y2K-compliant memo? Of course you can. Is that
- the pencil's fault? Of course it isn't.
-
- The date and time functions supplied with perl (gmtime and
- localtime) supply adequate information to determine the
- year well beyond 2000 (2038 is when trouble strikes for
- 32-bit machines). The year returned by these functions
- when used in a list context is the year minus 1900. For
- years between 1910 and 1999 this happens to be a 2-digit
- decimal number. To avoid the year 2000 problem simply do
- not treat the year as a 2-digit number. It isn't.
-
- When gmtime() and localtime() are used in scalar context
- they return a timestamp string that contains a fully-
- expanded year. For example, $timestamp =
- gmtime(1005613200) sets $timestamp to "Tue Nov 13 01:00:00
- 2001". There's no year 2000 problem here.
-
- That doesn't mean that Perl can't be used to create non-
- Y2K compliant programs. It can. But so can your pencil.
- It's the fault of the user, not the language. At the risk
- of inflaming the NRA: ``Perl doesn't break Y2K, people
- do.'' See http://language.perl.com/news/y2k.html for a
- longer exposition.
-
- If you want perl to warn you when it sees a program which
- concatenates a number with the string "19" -- a common
- indication of a year 2000 problem -- build perl using the
- Configure option "-Accflags=-DPERL_Y2KWARN".
- (See the file INSTALL for more information about building
- perl.)
'untie' => 86,
'utf8' => 88,
'void' => 90,
- 'y2k' => 92,
# Warnings Categories added in Perl 5.009
- 'assertions' => 94,
+ 'assertions' => 92,
);
our %Bits = (
- 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55", # [0..47]
+ 'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15", # [0..46]
'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [29]
- 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40", # [47]
+ 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [46]
'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00", # [30]
'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
'closure' => "\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1]
'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [43]
'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [44]
'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [45]
- 'y2k' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [46]
);
our %DeadBits = (
- 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", # [0..47]
+ 'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x2a", # [0..46]
'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [29]
- 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80", # [47]
+ 'assertions' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [46]
'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00", # [30]
'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
'closure' => "\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [1]
'untie' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [43]
'utf8' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [44]
'void' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [45]
- 'y2k' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [46]
);
$NONE = "\0\0\0\0\0\0\0\0\0\0\0\0";
-$LAST_BIT = 96 ;
+$LAST_BIT = 94 ;
$BYTES = 12 ;
$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
# Don't copy these top level READMEs
%Ignore
= (
- Y2K => 1,
micro => 1,
# vms => 1,
);
literal @foo, then write it as \@foo; otherwise find out what happened
to the array you apparently lost track of.
-=item Possible Y2K bug: %s
-
-(W y2k) You are concatenating the number 19 with another number, which
-could be a potential Year 2000 problem.
-
=item pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead
(D deprecated) You have written something like this:
+- utf8
|
+- void
- |
- +- y2k
Just like the "strict" pragma any of these categories can be combined
SvUTF8_off(TARG);
}
-#if defined(PERL_Y2KWARN)
- if ((SvIOK(right) || SvNOK(right)) && ckWARN(WARN_Y2K) && SvOK(TARG)) {
- if (llen >= 2 && lpv[llen - 2] == '1' && lpv[llen - 1] == '9'
- && (llen == 2 || !isDIGIT(lpv[llen - 3])))
- {
- Perl_warner(aTHX_ packWARN(WARN_Y2K), "Possible Y2K bug: %s",
- "about to append an integer to '19'");
- }
- }
-#endif
-
if (lbyte != rbyte) {
if (lbyte)
sv_utf8_upgrade_nomg(TARG);
}
break;
default: /* it had better be ten or less */
-#if defined(PERL_Y2KWARN)
- if (ckWARN(WARN_Y2K)) {
- STRLEN n;
- char *s = SvPV(sv,n);
- if (n >= 2 && s[n-2] == '1' && s[n-1] == '9'
- && (n == 2 || !isDIGIT(s[n-3])))
- {
- Perl_warner(aTHX_ packWARN(WARN_Y2K),
- "Possible Y2K bug: %%%c %s",
- c, "format string following '19'");
- }
- }
-#endif
do {
dig = uv % base;
*--eptr = '0' + dig;
Deep recursion on anonymous subroutine [Perl_sub_crush_depth]
$a = sub { &$a if $a++ < 200} &$a
- Possible Y2K bug: about to append an integer to '19' [pp_concat]
- $x = "19$yy\n";
-
Use of reference "%s" as array index [pp_aelem]
$x[\1]
Use of uninitialized value $y in concatenation (.) or string at - line 7.
Use of uninitialized value $y in concatenation (.) or string at - line 8.
########
-# pp_hot.c [pp_concat]
-use warnings 'y2k';
-use Config;
-BEGIN {
- unless ($Config{ccflags} =~ /Y2KWARN/) {
- print "SKIPPED\n# perl not built with -DPERL_Y2KWARN";
- exit 0;
- }
-}
-my $x;
-my $yy = 78;
-$x = "19$yy\n";
-$x = "19" . $yy . "\n";
-$x = "319$yy\n";
-$x = "319" . $yy . "\n";
-$yy = 19;
-$x = "ok $yy\n";
-$yy = 9;
-$x = 1 . $yy;
-no warnings 'y2k';
-$x = "19$yy\n";
-$x = "19" . $yy . "\n";
-EXPECT
-Possible Y2K bug: about to append an integer to '19' at - line 12.
-Possible Y2K bug: about to append an integer to '19' at - line 13.
-########
# pp_hot.c [pp_aelem]
{
use warnings 'misc';
Undefined value assigned to typeglob
- Possible Y2K bug: %d format string following '19'
-
Reference is already weak [Perl_sv_rvweaken] <<TODO
Mandatory Warnings
Undefined value assigned to typeglob at - line 3.
########
# sv.c
-use warnings 'y2k';
-use Config;
-BEGIN {
- unless ($Config{ccflags} =~ /Y2KWARN/) {
- print "SKIPPED\n# perl not built with -DPERL_Y2KWARN";
- exit 0;
- }
- $|=1;
-}
-my $x;
-my $yy = 78;
-$x = printf "19%02d\n", $yy;
-$x = sprintf "#19%02d\n", $yy;
-$x = printf " 19%02d\n", 78;
-$x = sprintf "19%02d\n", 78;
-$x = printf "319%02d\n", $yy;
-$x = sprintf "319%02d\n", $yy;
-no warnings 'y2k';
-$x = printf "19%02d\n", $yy;
-$x = sprintf "19%02d\n", $yy;
-$x = printf "19%02d\n", 78;
-$x = sprintf "19%02d\n", 78;
-EXPECT
-Possible Y2K bug: %d format string following '19' at - line 16.
-Possible Y2K bug: %d format string following '19' at - line 13.
-1978
-Possible Y2K bug: %d format string following '19' at - line 14.
-Possible Y2K bug: %d format string following '19' at - line 15.
- 1978
-31978
-1978
-1978
-########
-# sv.c
use warnings 'numeric' ;
$a = "\x{100}\x{200}" * 42;
no warnings 'numeric' ;
sub testwarn {
my $w = shift;
- is( (caller(0))[9], $w, "warnings");
+ is( (caller(0))[9], $w, "warnings match caller");
}
# NB : extend the warning mask values below when new warnings are added
{
no warnings;
- BEGIN { is( ${^WARNING_BITS}, "\0" x 12, 'warning bits' ) }
+ BEGIN { is( ${^WARNING_BITS}, "\0" x 12, 'all bits off via "no warnings"' ) }
testwarn("\0" x 12);
+
use warnings;
- BEGIN { is( ${^WARNING_BITS}, "U" x 12, 'warning bits' ) }
- BEGIN { testwarn("U" x 12); }
+ BEGIN { is( ${^WARNING_BITS}, "UUUUUUUUUUU\025", 'default bits on via "use warnings"' ); }
+ BEGIN { testwarn("UUUUUUUUUUU\025", "#1"); }
# run-time :
# the warning mask has been extended by warnings::register
- testwarn("UUUUUUUUUUUU\001");
+ testwarn("UUUUUUUUUUUU");
+
use warnings::register;
- BEGIN { is( ${^WARNING_BITS}, "UUUUUUUUUUUU\001", 'warning bits' ) }
- testwarn("UUUUUUUUUUUU\001");
+ BEGIN { is( ${^WARNING_BITS}, "UUUUUUUUUUUU", 'warning bits on via "use warnings::register"' ) }
+ testwarn("UUUUUUUUUUUU","#3");
}
#define WARN_UNTIE 43
#define WARN_UTF8 44
#define WARN_VOID 45
-#define WARN_Y2K 46
/* Warnings Categories added in Perl 5.009 */
-#define WARN_ASSERTIONS 47
+#define WARN_ASSERTIONS 46
#define WARNsize 12
#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125"
'misc' => [ 5.008, DEFAULT_OFF],
'regexp' => [ 5.008, DEFAULT_OFF],
'glob' => [ 5.008, DEFAULT_OFF],
- 'y2k' => [ 5.008, DEFAULT_OFF],
'untie' => [ 5.008, DEFAULT_OFF],
'substr' => [ 5.008, DEFAULT_OFF],
'taint' => [ 5.008, DEFAULT_OFF],