My question is how do I trap the warning
Warnings go to STDERR, a file handle that is already open.
You can redirect them somewhere, as in below example to a file:
close(STDERR)
or die qq(This should not go wrong, but this happened: $!\n);
my $warnings = qq(pid.$$.err_warn); # file to contain warnings & error
+ messages
open(STDERR, ">", $warnings)
or die qq(unable to open "$warnings" for writing because of: $!\n);
Cheers, Sören
Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)