Fully qualify in warning message the name of a subroutine redefined
Rafael Garcia-Suarez [Sun, 7 Apr 2002 19:34:10 +0000 (19:34 +0000)]
via glob assignment

p4raw-id: //depot/perl@15789

sv.c
t/lib/warnings/op
t/lib/warnings/sv

diff --git a/sv.c b/sv.c
index 80dc9ea..e3b9580 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3839,8 +3839,9 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV *sstr, I32 flags)
                                {
                                    Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
                                        CvCONST(cv)
-                                       ? "Constant subroutine %s redefined"
-                                       : "Subroutine %s redefined",
+                                       ? "Constant subroutine %s::%s redefined"
+                                       : "Subroutine %s::%s redefined",
+                                       HvNAME(GvSTASH((GV*)dstr)),
                                        GvENAME((GV*)dstr));
                                }
                            }
index 7833562..9b20a8c 100644 (file)
@@ -775,7 +775,7 @@ no warnings 'redefine' ;
 sub fred () { 1 }
 *fred = sub () { 2 };
 EXPECT
-Constant subroutine fred redefined at - line 4.
+Constant subroutine main::fred redefined at - line 4.
 ########
 # op.c
 use warnings 'redefine' ;
index 3903df3..d9aa827 100644 (file)
@@ -262,7 +262,7 @@ no warnings 'redefine' ;
 sub jim {} 
 *jim = \&joe ;
 EXPECT
-Subroutine fred redefined at - line 5.
+Subroutine main::fred redefined at - line 5.
 ########
 # sv.c
 use warnings 'printf' ;