in reply to Re^5: Constant subroutine main::C redefined
in thread Constant subroutine main::C redefined
perldiag says "(S) A severe warning (enabled by default)." which is probably part of the problem. But it is still easy to get around in a couple of different ways:
#!/usr/bin/perl -w BEGIN { $SIG{__WARN__} = sub { warn @_ if $_[0] !~ /^Constant subroutine/; } } sub FOO() { 23 } sub FOO() { 42 }
Or
#!/usr/bin/perl -w sub FOO() { 23 } BEGIN { no warnings 'misc'; undef &FOO if ! @ARGV } sub FOO() { 42 }
I threw in the 'if ! @ARGV' just so one can see the warning produced or suppressed by the same code.
- tye
|
|---|