#define ck_glob Perl_ck_glob
#define ck_grep Perl_ck_grep
#define ck_index Perl_ck_index
+#define ck_join Perl_ck_join
#define ck_lengthconst Perl_ck_lengthconst
#define ck_lfun Perl_ck_lfun
#define ck_listiob Perl_ck_listiob
#define ck_glob(a) Perl_ck_glob(aTHX_ a)
#define ck_grep(a) Perl_ck_grep(aTHX_ a)
#define ck_index(a) Perl_ck_index(aTHX_ a)
+#define ck_join(a) Perl_ck_join(aTHX_ a)
#define ck_lengthconst(a) Perl_ck_lengthconst(aTHX_ a)
#define ck_lfun(a) Perl_ck_lfun(aTHX_ a)
#define ck_listiob(a) Perl_ck_listiob(aTHX_ a)
#define ck_grep Perl_ck_grep
#define Perl_ck_index CPerlObj::Perl_ck_index
#define ck_index Perl_ck_index
+#define Perl_ck_join CPerlObj::Perl_ck_join
+#define ck_join Perl_ck_join
#define Perl_ck_lengthconst CPerlObj::Perl_ck_lengthconst
#define ck_lengthconst Perl_ck_lengthconst
#define Perl_ck_lfun CPerlObj::Perl_ck_lfun
#define Perl_ck_index pPerl->Perl_ck_index
#undef ck_index
#define ck_index Perl_ck_index
+#undef Perl_ck_join
+#define Perl_ck_join pPerl->Perl_ck_join
+#undef ck_join
+#define ck_join Perl_ck_join
#undef Perl_ck_lengthconst
#define Perl_ck_lengthconst pPerl->Perl_ck_lengthconst
#undef ck_lengthconst
}
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;
Perl_ck_fun, /* unpack */
Perl_ck_fun, /* pack */
Perl_ck_split, /* split */
- Perl_ck_fun, /* join */
+ Perl_ck_join, /* join */
Perl_ck_null, /* list */
Perl_ck_null, /* lslice */
Perl_ck_fun, /* anonlist */
unpack unpack ck_fun @ S S
pack pack ck_fun mst@ S L
split split ck_split t@ S S S
-join join ck_fun msT@ S L
+join join ck_join msT@ S L
# List operators.
return ((CPerlObj*)pPerl)->Perl_ck_index(o);
}
+#undef Perl_ck_join
+OP *
+Perl_ck_join(pTHXo_ OP *o)
+{
+ return ((CPerlObj*)pPerl)->Perl_ck_join(o);
+}
+
#undef Perl_ck_lengthconst
OP *
Perl_ck_lengthconst(pTHXo_ OP *o)
block. Perhaps you terminated the parameter list of the previous attribute
too soon.
+=item /%s/ should probably be written as "%s"
+
+(W) You have used a pattern where Perl expected to find a string,
+like in the first argument to C<join>. Perl will treat the true
+or false result of matching the pattern against $_ as the string,
+which is probably not what you had in mind.
+
=head1 Obsolete Diagnostics
Todo.
by Perl. This combination appears in an interpolated variable or a
C<'>-delimited regular expression.
+=item /%s/ should probably be written as "%s"
+
+(W) You have used a pattern where Perl expected to find a string,
+like in the first argument to C<join>. Perl will treat the true
+or false result of matching the pattern against $_ as the string,
+which is probably not what you had in mind.
+
=item %s (...) interpreted as function
(W) You've run afoul of the rule that says that any list operator followed
$rec = join(':', $login,$passwd,$uid,$gid,$gcos,$home,$shell);
-See L</split>.
+Beware that unlike C<split>, C<join> doesn't take a pattern as its
+first argument. Compare L</split>.
=item keys HASH
Perl_ck_glob
Perl_ck_grep
Perl_ck_index
+Perl_ck_join
Perl_ck_lengthconst
Perl_ck_lfun
Perl_ck_listiob
PERL_CKDEF(Perl_ck_glob)
PERL_CKDEF(Perl_ck_grep)
PERL_CKDEF(Perl_ck_index)
+PERL_CKDEF(Perl_ck_join)
PERL_CKDEF(Perl_ck_lengthconst)
PERL_CKDEF(Perl_ck_lfun)
PERL_CKDEF(Perl_ck_listiob)
defined(%hash) is deprecated
(Maybe you should just omit the defined()?)
my %h ; defined %h ;
+
+ /---/ should probably be written as "---"
+ join(/---/, @foo);
Mandatory Warnings
------------------
oops: oopsAV [oopsAV] TODO
oops: oopsHV [oopsHV] TODO
-
-
__END__
# op.c
Prototype mismatch: sub main::fred () vs ($) at - line 4.
Prototype mismatch: sub main::freD () vs ($) at - line 11.
Prototype mismatch: sub main::FRED () vs ($) at - line 14.
+########
+# op.c
+use warnings 'syntax' ;
+join /---/, 'x', 'y', 'z';
+EXPECT
+/---/ should probably be written as "---" at - line 3.