Subject: | Eliminate warnings about "subroutine redefined" |
Have run into this on a mod_perl based application I'm working on, where I'm using
HTTP::Exception; screen after screen of warnings:
Constant subroutine code redefined at (eval 614) line 4.
Constant subroutine _status_message redefined at (eval 614) line 5.
...
Happens as each time I load another module that pulls in HTTP::Exception, it redefines all of
the subs again on import.
Rather than trying to get it to only import the subs once, I've found that just putting a
no warnings 'redefine';
right before the final "eval $code" at the end does the trick. Methods get redefined (which is
fine), but the screens full of warnings disappear and also no longer show up in my Apache
log.