summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-09-06 00:10:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-09-06 00:10:40 +0000
commiteb6e2d6f1e269264d7937d1be23cbbe0b6820902 (patch)
tree35c59e04b4db7af027ae8dd6addaada967b4b1b6 /op.c
parent98627ae8f09f88a753760c651828da353f8c4989 (diff)
downloadperl-eb6e2d6f1e269264d7937d1be23cbbe0b6820902.tar.gz
optional warning on join(/foo/...) (reworked suggested patch
by Mark-Jason Dominus <mjd@plover.com>) p4raw-id: //depot/perl@4083
Diffstat (limited to 'op.c')
-rw-r--r--op.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/op.c b/op.c
index ae477d88ff..3f5541c650 100644
--- a/op.c
+++ b/op.c
@@ -5717,6 +5717,23 @@ Perl_ck_split(pTHX_ OP *o)
}
OP *
+Perl_ck_join(pTHX_ OP *o)
+{
+ if (ckWARN(WARN_SYNTAX)) {
+ OP *kid = cLISTOPo->op_first->op_sibling;
+ if (kid && kid->op_type == OP_MATCH) {
+ char *pmstr = "STRING";
+ if (kPMOP->op_pmregexp)
+ pmstr = kPMOP->op_pmregexp->precomp;
+ Perl_warner(aTHX_ WARN_SYNTAX,
+ "/%s/ should probably be written as \"%s\"",
+ pmstr, pmstr);
+ }
+ }
+ return ck_fun(o);
+}
+
+OP *
Perl_ck_subr(pTHX_ OP *o)
{
dTHR;