in reply to best way to handle Subroutine redefined warning
My guess is that there is already a subroutine called "redirect" in one of the Perl modules that I am already using.One way to find that out is to read the module docs. CGI makes mention of a redirect method. So you could grep through the source code, either at CGI, or at your unix command line:
Sure enough, there is a sub redirect.grep -w redirect `perldoc -l CGI`
Now, where does that warning message come from? A look at perldiag shows:
Subroutine %s redefined (W redefine) You redefined a subroutine. To suppress this warning, say 1. { 2. no warnings 'redefine'; 3. eval "sub name { ... }"; 4. }
Update: a closer look at CGI.pm shows that :standard exports :cgi which exports the redirect sub. An option is to only export what you need. You could change this line to not export redirect:
use CGI qw/:standard/;
|
|---|