On 2023-03-05 18:23, demerphq wrote: > [...] I wonder if perhaps deprecation > warnings should be automatically "warn once". Then some things should only warn once per total test, others once per test-phase, others once per $$, __PACKAGE__ / __FILE__, __LINE__. (just saying that likely needs some interesting instrumentation) -- Ruud For the in-process-level, I often use this: sub warn_once { my ( undef, $c_fname, $c_line )= caller; my $key= join "\0", $$, $c_fname, $c_line, @_; #TODO: unify timestamps?; md5() state %warn_once; $warn_once{ $key }++ or warn @_, ( (@_ and $_[-1] =~ /\n\z/) ? () : " at $c_fname line $c_line. (warn_once)\n" ); }Thread Previous | Thread Next