diff options
-rw-r--r-- | dump.c | 4 | ||||
-rw-r--r-- | op.c | 5 | ||||
-rw-r--r-- | op.h | 10 | ||||
-rw-r--r-- | pp_sys.c | 12 |
4 files changed, 25 insertions, 6 deletions
@@ -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)) @@ -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); @@ -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 }; @@ -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; |