summaryrefslogtreecommitdiff
path: root/lib/vmsish.t
diff options
context:
space:
mode:
authorPeter Prymmer <PPrymmer@factset.com>2003-06-11 05:00:34 -0400
committerH.Merijn Brand <h.m.brand@xs4all.nl>2003-06-11 14:06:49 +0000
commitef275d6f08d4a9026701c644c1a428d91f4e0ba3 (patch)
treeac13da2a7ed7476d151545834b00d63be0f7887b /lib/vmsish.t
parent8267c26231a981c8bf518d9a17713993cce69149 (diff)
downloadperl-ef275d6f08d4a9026701c644c1a428d91f4e0ba3.tar.gz
fix vmsish.t #25 by letting $0 find itself in the face of chdir() calls
Message-ID: <OF2535E971.A30D9C74-ON85256D42.00461FF9-85256D42.004776C4@factset.com> p4raw-id: //depot/perl@19741
Diffstat (limited to 'lib/vmsish.t')
-rw-r--r--lib/vmsish.t17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/vmsish.t b/lib/vmsish.t
index ff3f5b5e06..aad4a4a66f 100644
--- a/lib/vmsish.t
+++ b/lib/vmsish.t
@@ -112,6 +112,19 @@ 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";
+ }
{
use_ok('vmsish qw(time)');
@@ -121,12 +134,12 @@ is($?,0,"outer lex scope of vmsish [POSIX status]");
$vmstime = time;
@vmslocal = localtime($vmstime);
@vmsgmtime = gmtime($vmstime);
- $vmsmtime = (stat $0)[9];
+ $vmsmtime = (stat $self)[9];
}
$utctime = time;
@utclocal = localtime($vmstime);
@utcgmtime = gmtime($vmstime);
- $utcmtime = (stat $0)[9];
+ $utcmtime = (stat $self)[9];
$offset = $ENV{'SYS$TIMEZONE_DIFFERENTIAL'};