I've just run into an odd problem while testing one of my modules that has me
stumped. I'm running Perl 5.8.8 on AIX 6.1.
I'm testing a new module that uses one of my other modules. The second module
uses the DateTime module and includes code to assign the local timezone to a
variable. It sort of works like this:
MyMODULE...
...
Use MODULE2;
Use DateTime;
our $localtz = DateTime::TimeZone->new( name => 'local' );
I'm having trouble with the most basic test, just trying to use my module:
#!perl -T
use Test::More tests => 1;
BEGIN {
use_ok( 'MyMODULE' );
}
diag( "Testing MyMODULE $ MyMODULE::VERSION, Perl $], $^X" );
When I run 'make test', the test fails with this error:
'Error: Cannot determine local time zone'
If I run the test script directly, 'perl -T t/00-load.t', the test passes.
I tried using the $TZ environment variable (which is set to my time zone of
PST8PDT) instead of 'local' in MODULE2. That gives me an 'Unknown error' with
'make test' but it still passes when run directly.
The only way I can get this to work with 'make test' is to hardcode the
timezone in MODULE2, replacing 'local' with 'PST8PDT'. I really don't want to
hardcode this.
It seems like somehow the environment isn't quite right when I run the test via
'make test' so when DateTime tries to get the local timezone, it can't figure
it out.
Can I add something to Makefile.PL to make sure the timezone is in the
environment? I checked the ExtUtils::MakeMaker pod but didn't see anything
obvious that looked like it would set environment variables. I tried looking at
the Test::Harness pod and code but didn't see anything there that might help
explain what was going wrong, either.
Does anyone have any ideas?
Thanks.
Jerry Ursetti
__ __ __
/_ / | (_ /\/\
/ /__/ _ ) / \
Financial Data Systems and Analytics Management
(805)557-4212 (Work)
(805)732-8484 (Blackberry)
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information or otherwise be protected by law. Any
unauthorized review, use, disclosure or distribution is prohibited. If you
are not the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message.
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for
the sole use of the intended recipient(s) and may contain confidential and
privileged information or otherwise protected by law. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of
the original message.