From 25e26107ac5b0e993435044da1c1f81958f56c0d Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 23 Jun 2013 15:20:07 -0700 Subject: [PATCH] =?utf8?q?perldiag:=20Correct=20=E2=80=98length()=20used?= =?utf8?q?=20on=20%s=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- op.c | 2 ++ pod/perldiag.pod | 2 +- t/porting/diag.t | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/op.c b/op.c index 6be3114..18b065c 100644 --- a/op.c +++ b/op.c @@ -10734,9 +10734,11 @@ Perl_ck_length(pTHX_ OP *o) name, hash ? "keys " : "", name ); else if (hash) + /* diag_listed_as: length() used on %s (did you mean "scalar(%s)"?) */ Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "length() used on %%hash (did you mean \"scalar(keys %%hash)\"?)"); else + /* diag_listed_as: length() used on %s (did you mean "scalar(%s)"?) */ Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "length() used on @array (did you mean \"scalar(@array)\"?)"); } diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 17bea47..f4edbd4 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2712,7 +2712,7 @@ effective uids or gids failed. length/code combination tried to obtain more data. This results in an undefined value for the length. See L. -=item length() used on %s +=item length() used on %s (did you mean "scalar(%s)"?) (W syntax) You used length() on either an array or a hash when you probably wanted a count of the items. diff --git a/t/porting/diag.t b/t/porting/diag.t index bafe346..56866e1 100644 --- a/t/porting/diag.t +++ b/t/porting/diag.t @@ -511,9 +511,6 @@ Invalid type '%c' in unpack Invalid type ',' in %s ioctlsocket not implemented! killpg not implemented! -length() used on %s (did you mean "scalar(%s)"?) -length() used on %hash (did you mean "scalar(keys %hash)"?) -length() used on @array (did you mean "scalar(@array)"?) List form of pipe open not implemented Malformed integer in [] in %s Malformed UTF-8 character (fatal) -- 2.7.4