summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Nandor <pudge@pobox.com>2002-01-17 06:26:02 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-21 14:07:35 +0000
commitbe4b629d01f2d7652ca23d114058450262ebd49b (patch)
tree198ff4cf50367ec22554c6bd5b699fe4fee05859
parent3d1a39c8be0d615d52d784b13d1b1dd635567f2a (diff)
downloadperl-be4b629d01f2d7652ca23d114058450262ebd49b.tar.gz
Re: coderefs in @INC
Message-Id: <p0510030eb86ca7bc03e0@[10.0.1.177]> p4raw-id: //depot/perl@14366
-rw-r--r--pp_ctl.c50
1 files changed, 29 insertions, 21 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 7d777f583f..a7736e3213 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2927,30 +2927,11 @@ PP(pp_require)
/* prepare to compile file */
-#ifdef MACOS_TRADITIONAL
- if (PERL_FILE_IS_ABSOLUTE(name)
- || (*name == ':' && name[1] != ':' && strchr(name+2, ':')))
- {
+ if (path_is_absolute(name)) {
tryname = name;
tryrsfp = doopen_pmc(name,PERL_SCRIPT_MODE);
- /* We consider paths of the form :a:b ambiguous and interpret them first
- as global then as local
- */
- if (!tryrsfp && *name == ':' && name[1] != ':' && strchr(name+2, ':'))
- goto trylocal;
}
- else
-trylocal: {
-#else
- if (PERL_FILE_IS_ABSOLUTE(name)
- || (*name == '.' && (name[1] == '/' ||
- (name[1] == '.' && name[2] == '/'))))
- {
- tryname = name;
- tryrsfp = doopen_pmc(name,PERL_SCRIPT_MODE);
- }
- else {
-#endif
+ if (!tryrsfp) {
AV *ar = GvAVn(PL_incgv);
I32 i;
#ifdef VMS
@@ -3073,6 +3054,14 @@ trylocal: {
}
}
else {
+ if (!path_is_absolute(name)
+#ifdef MACOS_TRADITIONAL
+ /* We consider paths of the form :a:b ambiguous and interpret them first
+ as global then as local
+ */
+ || (*name == ':' && name[1] != ':' && strchr(name+2, ':'))
+#endif
+ ) {
char *dir = SvPVx(dirsv, n_a);
#ifdef MACOS_TRADITIONAL
char buf[256];
@@ -3104,6 +3093,7 @@ trylocal: {
tryname += 2;
break;
}
+ }
}
}
}
@@ -3700,3 +3690,21 @@ run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
return len;
}
+/* perhaps someone can come up with a better name for
+ this? it is not really "absolute", per se ... */
+bool
+path_is_absolute(char *name)
+{
+ if (PERL_FILE_IS_ABSOLUTE(name)
+#ifdef MACOS_TRADITIONAL
+ || (*name == ':' && name[1] != ':' && strchr(name+2, ':')))
+#else
+ || (*name == '.' && (name[1] == '/' ||
+ (name[1] == '.' && name[2] == '/'))))
+#endif
+ {
+ return TRUE;
+ }
+ else
+ return FALSE;
+}