Change 14200 by jhi@alpha on 2002/01/12 00:02:05

        Subject: [PATCH] Correct misleading error message
        From: Mike Guy <[EMAIL PROTECTED]>
        Date: Fri, 11 Jan 2002 18:36:33 +0000
        Message-Id: <[EMAIL PROTECTED]>
        
        hash assignment -> anonymous hash

Affected files ...

.... //depot/perl/pod/perldiag.pod#261 edit
.... //depot/perl/pp.c#327 edit
.... //depot/perl/t/lib/warnings/pp#5 edit
.... //depot/perl/t/op/hashwarn.t#9 edit

Differences ...

==== //depot/perl/pod/perldiag.pod#261 (text) ====
Index: perl/pod/perldiag.pod
--- perl/pod/perldiag.pod.~1~   Fri Jan 11 17:15:05 2002
+++ perl/pod/perldiag.pod       Fri Jan 11 17:15:05 2002
@@ -2370,6 +2370,11 @@
 (W) The call to overload::constant contained an odd number of arguments.
 The arguments should come in pairs.
 
+=item Odd number of elements in anonymous hash
+
+(W misc) You specified an odd number of elements to initialize a hash,
+which is odd, because hashes come in key/value pairs.
+
 =item Odd number of elements in hash assignment
 
 (W misc) You specified an odd number of elements to initialize a hash,

==== //depot/perl/pp.c#327 (text) ====
Index: perl/pp.c
--- perl/pp.c.~1~       Fri Jan 11 17:15:05 2002
+++ perl/pp.c   Fri Jan 11 17:15:05 2002
@@ -3848,7 +3848,7 @@
        if (MARK < SP)
            sv_setsv(val, *++MARK);
        else if (ckWARN(WARN_MISC))
-           Perl_warner(aTHX_ WARN_MISC, "Odd number of elements in hash assignment");
+           Perl_warner(aTHX_ WARN_MISC, "Odd number of elements in anonymous hash");
        (void)hv_store_ent(hv,key,val,0);
     }
     SP = ORIGMARK;

==== //depot/perl/t/lib/warnings/pp#5 (text) ====
Index: perl/t/lib/warnings/pp
--- perl/t/lib/warnings/pp.~1~  Fri Jan 11 17:15:05 2002
+++ perl/t/lib/warnings/pp      Fri Jan 11 17:15:05 2002
@@ -67,7 +67,7 @@
 no warnings 'misc' ;
 my $b = { 1,2,3};
 EXPECT
-Odd number of elements in hash assignment at - line 3.
+Odd number of elements in anonymous hash at - line 3.
 ########
 # pp.c
 use warnings 'misc' ;

==== //depot/perl/t/op/hashwarn.t#9 (xtext) ====
Index: perl/t/op/hashwarn.t
--- perl/t/op/hashwarn.t.~1~    Fri Jan 11 17:15:05 2002
+++ perl/t/op/hashwarn.t        Fri Jan 11 17:15:05 2002
@@ -45,7 +45,8 @@
 #   print "# $num: $got\n";
 }
 
-my $odd_msg = '/^Odd number of elements in hash/';
+my $odd_msg = '/^Odd number of elements in hash assignment/';
+my $odd_msg2 = '/^Odd number of elements in anonymous hash/';
 my $ref_msg = '/^Reference found where even-sized list expected/';
 
 {
@@ -56,7 +57,7 @@
     test_warning 2, shift @warnings, $odd_msg;
 
     %hash = { 1..3 };
-    test_warning 3, shift @warnings, $odd_msg;
+    test_warning 3, shift @warnings, $odd_msg2;
     test_warning 4, shift @warnings, $ref_msg;
 
     %hash = [ 1..3 ];
End of Patch.

Reply via email to