in reply to Re^7: Constant subroutine main::C redefined
in thread Constant subroutine main::C redefined
Tried that also :(
C:\test>perl -wE"no warnings 'redefine';sub FOO(){23};sub FOO(){42 if +$];};say$];" Constant subroutine FOO redefined at -e line 1. 5.014002
Dropping the prototype isn't an option either because the constant getting redefined is a very rare occurence (but one that must be catered for), and I don't want to lose the benefits of compile time optimisations for the majority of cases.
If a constant sub is redefined to be the same value, it doesn't cause the warning:
C:\test>perl -wE"no warnings 'redefine';sub FOO(){23};sub FOO(){23};sa +y$];" 5.014002
which will be the majority of cases, but I cannot predict when the edge case might occur so I have to try the redefinition in all cases.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Constant subroutine main::C redefined
by tinita (Parson) on Sep 10, 2012 at 13:50 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2012 at 14:37 UTC | |
by tinita (Parson) on Sep 10, 2012 at 17:26 UTC | |
by kennethk (Abbot) on Sep 10, 2012 at 16:40 UTC | |
|
Re^9: Constant subroutine main::C redefined
by tobyink (Canon) on Sep 10, 2012 at 21:47 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2012 at 21:56 UTC | |
by tobyink (Canon) on Sep 10, 2012 at 22:43 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2012 at 23:47 UTC | |
by tobyink (Canon) on Sep 10, 2012 at 23:50 UTC | |
by Anonymous Monk on Sep 10, 2012 at 23:56 UTC |