in reply to catching warnings

Do you want to execute something when the warning occurs or do you just want to swallow it? If you want it to disappear, then

no warnings qw(void);

should do the trick. If you want to print a custom message, try

warnings::warn('void', 'TRAPED');

Note: any of the categories of warnings will work.
Good luck!