perl11 / cperl

A perl5 with classes, types, compilable, company friendly, security
http://perl11.org/
Other
142 stars 17 forks source link

improve WARN_REDEFINE, at caller file:line #113

Closed rurban closed 8 years ago

rurban commented 8 years ago

It makes not much sense to print the file:line of the subroutine redefinition, when loading a script twice. It just prints the location of the redefined function. We want to add the location of the caller who caused that 2nd wrong redefinition.

Subroutine %"SVf" redefined at %loc

=>

Subroutine %"SVf" redefined, called by %upperloc at %loc

$ perl -we'do "utf8.pm"; 
do "utf8.pm";'
Subroutine import redefined, called by -e:2 at /usr/src/perl/blead/cperl/lib/utf8.pm line 7.
Subroutine unimport redefined, called by -e:2 at /usr/src/perl/blead/cperl/lib/utf8.pm line 11.
Subroutine AUTOLOAD redefined, called by -e:2 at /usr/src/perl/blead/cperl/lib/utf8.pm line 15.
rurban commented 8 years ago

At CPAN only those modules depend on the warning msg and need distroprefs rules: Sub-Install

constant is already in core Class-Multimethods should be enhanced also. Test-Trap was fixed with 5.22.3

rurban commented 8 years ago

The 2nd printed location is wrong, causing regressions in Sub-Install/t/install.t The added 1st "called by" message does no harm there, but the cxstack_ix is off by one.