summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dump.c4
-rw-r--r--op.c5
-rw-r--r--op.h10
-rw-r--r--pp_sys.c12
4 files changed, 25 insertions, 6 deletions
diff --git a/dump.c b/dump.c
index 244d064867..119bfa3082 100644
--- a/dump.c
+++ b/dump.c
@@ -616,6 +616,10 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
if (o->op_private & OPpHUSH_VMSISH)
sv_catpv(tmpsv, ",HUSH_VMSISH");
}
+ else if (OP_IS_FILETEST_ACCESS(o)) {
+ if (o->op_private & OPpFT_ACCESS)
+ sv_catpv(tmpsv, ",FT_ACCESS");
+ }
if (o->op_flags & OPf_MOD && o->op_private & OPpLVAL_INTRO)
sv_catpv(tmpsv, ",INTRO");
if (SvCUR(tmpsv))
diff --git a/op.c b/op.c
index e32eab63db..be05875ca6 100644
--- a/op.c
+++ b/op.c
@@ -4933,6 +4933,11 @@ Perl_ck_ftst(pTHX_ OP *o)
op_free(o);
o = newop;
}
+ else {
+ if ((PL_hints & HINT_FILETEST_ACCESS) &&
+ OP_IS_FILETEST_ACCESS(o))
+ o->op_private |= OPpFT_ACCESS;
+ }
}
else {
op_free(o);
diff --git a/op.h b/op.h
index 831ccbbf5e..cfc5e2b4bd 100644
--- a/op.h
+++ b/op.h
@@ -205,6 +205,16 @@ Deprecated. Use C<GIMME_V> instead.
#define OPpHUSH_VMSISH 64 /* hush DCL exit msg vmsish mode*/
#define OPpEXIT_VMSISH 128 /* exit(0) vs. exit(1) vmsish mode*/
+/* Private of OP_FTXXX */
+#define OPpFT_ACCESS 2 /* use filetest 'access' */
+#define OP_IS_FILETEST_ACCESS(op) \
+ (((op)->op_type) == OP_FTRREAD || \
+ ((op)->op_type) == OP_FTRWRITE || \
+ ((op)->op_type) == OP_FTREXEC || \
+ ((op)->op_type) == OP_FTEREAD || \
+ ((op)->op_type) == OP_FTEWRITE || \
+ ((op)->op_type) == OP_FTEEXEC)
+
struct op {
BASEOP
};
diff --git a/pp_sys.c b/pp_sys.c
index 11b8edfc41..ae92422452 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2850,7 +2850,7 @@ PP(pp_ftrread)
dSP;
#if defined(HAS_ACCESS) && defined(R_OK)
STRLEN n_a;
- if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
+ if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) {
result = access(TOPpx, R_OK);
if (result == 0)
RETPUSHYES;
@@ -2877,7 +2877,7 @@ PP(pp_ftrwrite)
dSP;
#if defined(HAS_ACCESS) && defined(W_OK)
STRLEN n_a;
- if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
+ if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) {
result = access(TOPpx, W_OK);
if (result == 0)
RETPUSHYES;
@@ -2904,7 +2904,7 @@ PP(pp_ftrexec)
dSP;
#if defined(HAS_ACCESS) && defined(X_OK)
STRLEN n_a;
- if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
+ if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) {
result = access(TOPpx, X_OK);
if (result == 0)
RETPUSHYES;
@@ -2931,7 +2931,7 @@ PP(pp_fteread)
dSP;
#ifdef PERL_EFF_ACCESS_R_OK
STRLEN n_a;
- if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
+ if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) {
result = PERL_EFF_ACCESS_R_OK(TOPpx);
if (result == 0)
RETPUSHYES;
@@ -2958,7 +2958,7 @@ PP(pp_ftewrite)
dSP;
#ifdef PERL_EFF_ACCESS_W_OK
STRLEN n_a;
- if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
+ if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) {
result = PERL_EFF_ACCESS_W_OK(TOPpx);
if (result == 0)
RETPUSHYES;
@@ -2985,7 +2985,7 @@ PP(pp_fteexec)
dSP;
#ifdef PERL_EFF_ACCESS_X_OK
STRLEN n_a;
- if ((PL_hints & HINT_FILETEST_ACCESS) && SvPOK(TOPs)) {
+ if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) {
result = PERL_EFF_ACCESS_X_OK(TOPpx);
if (result == 0)
RETPUSHYES;