diff options
author | Craig A. Berry <craigberry@mac.com> | 2004-01-24 12:45:35 -0600 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-01-26 21:58:14 +0000 |
commit | 86c16cb1c6a1a5707a4ec9d76ea7b9a2aa2032da (patch) | |
tree | 805c0274762ade92465dffd43e504ff1b156072b /lib/vmsish.t | |
parent | 1400179bb96df41bb2e0f27ebfd439c299b0cec2 (diff) | |
download | perl-86c16cb1c6a1a5707a4ec9d76ea7b9a2aa2032da.tar.gz |
fix vmsish.t #25
From: "Craig A. Berry" <craigberry@mac.com>
Message-ID: <401311AF.1060706@mac.com>
p4raw-id: //depot/perl@22223
Diffstat (limited to 'lib/vmsish.t')
-rw-r--r-- | lib/vmsish.t | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/vmsish.t b/lib/vmsish.t index aad4a4a66f..71ca3b5e98 100644 --- a/lib/vmsish.t +++ b/lib/vmsish.t @@ -112,19 +112,17 @@ is($?,0,"outer lex scope of vmsish [POSIX status]"); eval "END { \$ENV{'SYS\$TIMEZONE_DIFFERENTIAL'} = $oldtz; }"; gmtime(0); # Force reset of tz offset } - # This test script might have been invoked in at least one of four different ways: - # perl lib/vmsish.t - # perl [.lib]vmsish.t - # set def [.t] && perl ../lib/vmsish.t - # set def [.t] && perl [-.lib]vmsish.t - # In the following we attempt to find ourselves without resorting to VMS::Filespec. - # Note that the chdir in the BEGIN block above complicates matters. - my $self = $0; - if ( ! -e $self && -e "../$0" ) { $self = "../$0"; } - if ( ! -e $self ) { - $self =~ s/\[//; - $self = "[-$self"; - } + + # Unless we are prepared to parse the timezone rules here and figure out + # what the correct offset was when the file was last revised, we need to + # use a file for which the current offset is known to be valid. That's why + # we create a file rather than using an existing one for the stat() test. + + my $file = 'sys$scratch:vmsish_t_flirble.tmp'; + open TMP, ">$file" or die "Couldn't open file $file"; + close TMP; + END { 1 while unlink $file; } + { use_ok('vmsish qw(time)'); @@ -134,12 +132,12 @@ is($?,0,"outer lex scope of vmsish [POSIX status]"); $vmstime = time; @vmslocal = localtime($vmstime); @vmsgmtime = gmtime($vmstime); - $vmsmtime = (stat $self)[9]; + $vmsmtime = (stat $file)[9]; } $utctime = time; @utclocal = localtime($vmstime); @utcgmtime = gmtime($vmstime); - $utcmtime = (stat $self)[9]; + $utcmtime = (stat $file)[9]; $offset = $ENV{'SYS$TIMEZONE_DIFFERENTIAL'}; |