I have no idea if you request XML :: LibXML so as not to print your warnings. I assume that you are, and this is an error in XML :: LibXML (which you should also tell the author), and only an address, how to suppress warnings.
Each time a warning is printed, perl will look for the value of $SIG{__WARN__} and, if it contains a link to the code, is called instead of printing the warning itself.
You can use this to stop the warnings you want to ignore for printing on STDERR . However, you must be careful with this. Be sure to suppress false alarms, not all warnings. Warnings are usually helpful. Also, be sure to localize your use of $SIG{__WARN__} to the smallest possible amount to avoid odd side effects.
# warnings happen just as always my $parser = ...; $parser->set_options(...); {
Also note that all of this implies that these warnings come from perl space. It is possible that libxml2, the C XML :: LibXML library uses under the hood, writes warnings directly to stderr itself. $SIG{__WARN__} will not be able to prevent this.
source share