FAQ 4.18 Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
FAQ 4.18 Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
am 16.09.2007 21:03:02 von PerlFAQ Server
This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
------------------------------------------------------------ --------
4.18: 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.
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://www.perl.org/about/y2k.html for a longer
exposition.
------------------------------------------------------------ --------
The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.
If you'd like to help maintain the perlfaq, see the details in
perlfaq.pod.
Re: FAQ 4.18 Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
am 16.09.2007 22:04:46 von Lars Eighner
In our last episode, <68b0s4-0ii.ln1@blue.stonehenge.com>, the lovely and
talented PerlFAQ Server broadcast on comp.lang.perl.misc:
> 4.18: Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
Isn't it about time to give this FAQ its gold watch and send it off to the
home?
--
Lars Eighner
Countdown: 491 days to go.
What do you do when you're debranded?
Re: FAQ 4.18 Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
am 16.09.2007 22:34:49 von paduille.4061.mumia.w+nospam
On 09/16/2007 03:04 PM, Lars Eighner wrote:
> In our last episode, <68b0s4-0ii.ln1@blue.stonehenge.com>, the lovely and
> talented PerlFAQ Server broadcast on comp.lang.perl.misc:
>
>> 4.18: Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
>
> Isn't it about time to give this FAQ its gold watch and send it off to the
> home?
>
>
No, it's still needed for historical reference, and there are a few
people who will have to deal with pre-2000-written scripts.
The discussion of some date issues is also important.
Re: FAQ 4.18 Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
am 17.09.2007 15:59:11 von Peter Scott
On Sun, 16 Sep 2007 15:34:49 -0500, Mumia W. wrote:
> On 09/16/2007 03:04 PM, Lars Eighner wrote:
>> In our last episode, <68b0s4-0ii.ln1@blue.stonehenge.com>, the lovely and
>> talented PerlFAQ Server broadcast on comp.lang.perl.misc:
>>
>>> 4.18: Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
>>
>> Isn't it about time to give this FAQ its gold watch and send it off to the
>> home?
>
> No, it's still needed for historical reference, and there are a few
> people who will have to deal with pre-2000-written scripts.
>
> The discussion of some date issues is also important.
I think the issue is with the 'F' part of FAQ. Yes, there are people who
want to know the answer to this question, but are there enough of them
left to justify its inclusion in the FAQ? Is the FAQ supposed to be a
Hotel California of answers that can check in but never leave? Weigh
the concern that leaving it in will create among many readers the
impression that the FAQ must be moribund.
Somewhere not in the perl distribution but referenced from it we can
surely create a repository of answers to questions that used to be
frequently asked, and make the FAQ more relevant.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
Re: FAQ 4.18 Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
am 17.09.2007 16:54:13 von Michele Dondi
On Mon, 17 Sep 2007 13:59:11 GMT, Peter Scott wrote:
>I think the issue is with the 'F' part of FAQ. Yes, there are people who
>want to know the answer to this question, but are there enough of them
>left to justify its inclusion in the FAQ? Is the FAQ supposed to be a
>Hotel California of answers that can check in but never leave? Weigh
>the concern that leaving it in will create among many readers the
>impression that the FAQ must be moribund.
Yes the FAQ has some entries which are more or less objectively
unlikely to rate F, but for what my opinion is worth, I don't see that
risk. I suppose it's difficult for someone to *accidentally* stumble
on that particular entry, or most others.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^
..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
Re: FAQ 4.18 Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
am 17.09.2007 17:50:45 von brian d foy
In article , Lars
Eighner wrote:
> In our last episode, <68b0s4-0ii.ln1@blue.stonehenge.com>, the lovely and
> talented PerlFAQ Server broadcast on comp.lang.perl.misc:
>
> > 4.18: Does Perl have a Year 2000 problem? Is Perl Y2K compliant?
>
> Isn't it about time to give this FAQ its gold watch and send it off to the
> home?
The year 2000 just hit Eithiopia :)