in reply to Re^2: Unnesting deeply nested HTML elements (Deep recursion on subroutine "HTML::Element::delete")
in thread Unnesting deeply nested HTML elements (Deep recursion on subroutine "HTML::Element::delete")
Yeah, warnings are lexically scoped, so turning them off in one place only suppresses them if that's where they are generated.
In this case you need to get a bit more invasive: catch all warnings for the duration of the call, and rethrow all but the one you want to avoid:
{ local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /^Deep recursion/; }; $ent->delete; }
Note that it is safe to warn inside the warnings handler - the handler is suppressed while it is being called.
|
|---|