Hi,
may thanks!
I've placed this in the respective module, which does the job. But I
guess it is not local?
BEGIN {
$SIG{__WARN__} = sub {
my $warn = shift;
return if $warn =~ /PDL::Primitive::conv1d does not handle bad
values at/;
warn $warn;
};
}
Ingo
On 16.10.25 2:29 PM, David Mertens wrote:
There is an official way for a module to establish warnings that
callers can enable or disable using warnings::register (see
https://perldoc.perl.org/warnings#Reporting-Warnings-from-a-Module). I
don't think PDL has done this.
The other approach is to set a warnings handler. brian d foy covers
that in an article about overriding warnings
(https://www.effectiveperlprogramming.com/2011/09/intercept-module-warnings-with-a-warn-handler/).
You will almost certainly want to use the "local" override since
that'll be reset after you exit the current block, just like a
lexically scoped "no 'warnings'" statement.
David
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
On Thu, Oct 16, 2025, 6:43 AM Ingo Schmid via pdl-general
<[email protected]> wrote:
Hi,
in my code, I use conv1d (PDL::Primitive) a lot, which generates a
BAD values warning every time. Is there a way to suppress this
selectively?
Thanks
Ingo
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general