#! BEGIN { # Convert the warning to Carp::cluck $SIG{__WARN__} = sub { Carp::cluck(@_); }; }; use Carp; use strict; use warnings; use Mod1; use Mod2; INIT { # Clear the warning to Carp::cluck $SIG{__WARN__}='DEFAULT'; }; sub One { # First definition return "first"; }; sub One { # Second definition return "second"; }; print One()."\n"; exit;
package Mod1; use Exporter; use strict; use warnings; @Mod1::ISA=qw(Exporter); @Mod1::EXPORT=qw(One); sub One { return "Mod1::One"; }; 1;
Running under Windows 2K/ActiveState 5.10 I getpackage Mod2; use strict; use warnings; use Mod1; @Mod2::ISA=qw(Exporter); @Mod2::EXPORT=qw(One); sub One { return "Mod1::One"; }; 1;
C:\Code\SecCage>perl redef.pl Subroutine One redefined at Mod2.pm line 10. at redef.pl line 5 main::__ANON__('Subroutine One redefined at Mod2.pm line 10.\x +{a}') called at Mod2.pm line 10 require Mod2.pm called at redef.pl line 12 main::BEGIN() called at Mod2.pm line 10 eval {...} called at Mod2.pm line 10 Subroutine One redefined at redef.pl line 19. at redef.pl line 5 main::__ANON__('Subroutine One redefined at redef.pl line 19.\ +x{a}') called at redef.pl line 19 Subroutine One redefined at redef.pl line 23. at redef.pl line 5 main::__ANON__('Subroutine One redefined at redef.pl line 23.\ +x{a}') called at redef.pl line 23 second
In reply to Re: How to located cause of 'Subroutine SomeSubName redefined...' warnings
by clueless newbie
in thread How to located cause of 'Subroutine SomeSubName redefined...' warnings
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |