Another thing I just noticed is that you ran your tests under
Apache::PerlRun, my mod_perl installation is using as its
PerlResponseHandler ModPerl::PerlRun. What's the difference between the
two?
Thank you,
Tyler.
-----Original Message-----
From: Garrett, Philip (MAN-Corporate) [mailto:suppressed
Sent: Tuesday, October 03, 2006 12:30 PM
To: Tyler; suppressed
Subject: RE: Using ENV{'TZ'} in mod_perl
Tyler Fullerton wrote:
>
> If I have the following script: www.somewhere.com/e3/datetz.cgi (where
> e3 is using PerlRun) that does the following:
>
> $ENV{'TZ'} = 'US/Eastern';
> POSIX::tzset();
> my @time = localtime();
> my $time = time();
> $ENV{'TZ'} = 'US/Pacific';
> POSIX::tzset();
>
> # I would expect this to print current time info in the Eastern
> # time zone.
> print "$_\n" foreach @time;
> print "$time\n";
>
> At this point I would expect the values returned in @time and $time to
> be in the Eastern timezone. This works no problem in a non-mod_perl'd
> environment but not under mod_perl.
This works fine for me. I tested under vanilla CGI, Apache::PerlRun, and
Apache::Registry.
> Would it be beneficial to put code in a PerlFixUpHandler that sets the
> time zone data?
I doubt it. If setting the time zone RIGHT before running localtime
doesn't help, I don't think setting it long before will.
The only thing I can think of that might be causing this is if
PerlTaintCheck is turned on in the mod_perl, and it doesn't like
something about the environment being monkeyed with.
What's the output when you run this?
#!/usr/bin/env perl
use strict;
use warnings;
use POSIX qw(tzset);
$ENV{'TZ'} = 'US/Eastern';
POSIX::tzset();
my $eastern = localtime();
$ENV{'TZ'} = 'US/Pacific';
POSIX::tzset();
my $pacific = localtime();
print "Content-type: text/plain\n\n",
"Eastern: $eastern\n",
"Pacific: $pacific\n";
Regards,
Philip
__________ NOD32 1.1788 (20061003) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.