From: Jan Dubois Date: Sat, 6 Nov 1999 22:16:43 +0000 (+0100) Subject: [5.005_62 PATCH] binmode and locale support for -T and -B filetest operators X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0dca5578cc53544bebb81ee96b49f700f76a2a0;p=p5sagit%2Fp5-mst-13.2.git [5.005_62 PATCH] binmode and locale support for -T and -B filetest operators To: perl5-porters@perl.org Cc: Mike Blazer , Mark Borgerding Message-ID: <38279207.46448719@smtprelay.t-online.de> p4raw-id: //depot/cfgperl@4528 --- diff --git a/op.c b/op.c index 56c2651..bcf154d 100644 --- a/op.c +++ b/op.c @@ -5017,10 +5017,10 @@ Perl_ck_ftst(pTHX_ OP *o) dTHR; I32 type = o->op_type; - if (o->op_flags & OPf_REF) - return o; - - if (o->op_flags & OPf_KIDS && cUNOPo->op_first->op_type != OP_STUB) { + if (o->op_flags & OPf_REF) { + /* nothing */ + } + else if (o->op_flags & OPf_KIDS && cUNOPo->op_first->op_type != OP_STUB) { SVOP *kid = (SVOP*)cUNOPo->op_first; if (kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE)) { @@ -5028,17 +5028,24 @@ Perl_ck_ftst(pTHX_ OP *o) OP *newop = newGVOP(type, OPf_REF, gv_fetchpv(SvPVx(kid->op_sv, n_a), TRUE, SVt_PVIO)); op_free(o); - return newop; + o = newop; } } else { op_free(o); if (type == OP_FTTTY) - return newGVOP(type, OPf_REF, gv_fetchpv("main::STDIN", TRUE, + o = newGVOP(type, OPf_REF, gv_fetchpv("main::STDIN", TRUE, SVt_PVIO)); else - return newUNOP(type, 0, newDEFSVOP()); + o = newUNOP(type, 0, newDEFSVOP()); } +#ifdef USE_LOCALE + if (type == OP_FTTEXT || type == OP_FTBINARY) { + o->op_private = 0; + if (PL_hints & HINT_LOCALE) + o->op_private |= OPpLOCALE; + } +#endif return o; } diff --git a/op.h b/op.h index d34435b..c1ce70b 100644 --- a/op.h +++ b/op.h @@ -158,7 +158,8 @@ typedef U32 PADOFFSET; /* Private for OP_DELETE */ #define OPpSLICE 64 /* Operating on a list of keys */ -/* Private for OP_SORT, OP_PRTF, OP_SPRINTF, string cmp'n, and case changers */ +/* Private for OP_SORT, OP_PRTF, OP_SPRINTF, OP_FTTEXT, OP_FTBINARY, */ +/* string comparisons, and case changers. */ #define OPpLOCALE 64 /* Use locale */ /* Private for OP_SORT */