Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Unnesting deeply nested HTML elements (Deep recursion on subroutine "HTML::Element::delete")

by hv (Prior)
on Sep 20, 2022 at 03:23 UTC ( [id://11147006]=note: print w/replies, xml ) Need Help??


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.

  • Comment on Re^3: Unnesting deeply nested HTML elements (Deep recursion on subroutine "HTML::Element::delete")
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147006]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-20 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found