in reply to Unnesting deeply nested HTML elements (Deep recursion on subroutine "HTML::Element::delete")

I thought I'd have a play with your issue so I downloaded your code and ran it. No warnings! So I wrote the following:

use strict; use warnings; print "$^V\n"; recurse(20000); exit; sub recurse { my ($count) = @_; recurse($count - 1) if $count; }

which prints

v5.32.1

No warnings! My guess is that the warning dropped out of Perl at some point, but I can't find anything on perldelta to indicate its been "fixed". Maybe Strawberry Perl has its recursion limit warning set to some really large value? I do get an "Out of memory!" error if I set the recursion limit to 700,000.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
  • Comment on Re: Unnesting deeply nested HTML elements (Deep recursion on subroutine "HTML::Element::delete")
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Unnesting deeply nested HTML elements (Deep recursion on subroutine "HTML::Element::delete")
by hv (Prior) on Sep 20, 2022 at 04:31 UTC

    I cannot reproduce your results with 5.32.0, 5.34.0 or 5.36.0, I get a "deep recursion" warning in every case. Do you have environment variables or an init script that could be suppressing it?

    v5.32.0 Deep recursion on subroutine "main::recurse" at testfile line 11. v5.34.0 Deep recursion on subroutine "main::recurse" at testfile line 11. v5.36.0 Deep recursion on subroutine "main::recurse" at testfile line 11.

    I don't have 5.32.1 handy, but I'd be astonished if this had been broken.

      I can't think of anything such as an environment variable or init script that may be coming into play. I'm running this on a fairly clean 64 bit Strawberry Perl without any environment tweaks explicitly made by me. I'll try again on my home machine.

      Update Same result at home. Same Perl version, but Windows 11 rather than Windows 10.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

        I just installed v5.32.1, and confirm that I still get the warning with that version too (on Ubuntu). I suggest contacting the people that make Strawberry Perl to see if they have an explanation.

        You can experiment a bit further to verify that the warnings bits are set appropriately, via a BEGIN block in the relevant scope:

        % perl-v5.32.1 -e 'use warnings; \ BEGIN { printf "%vx\n", ${^WARNING_BITS} }' 55.55.55.55.55.55.55.55.55.55.55.55.55.55.55.55.55.55.55 % perl-v5.32.1 -e 'use warnings; no warnings "recursion"; \ BEGIN { printf "%vx\n", ${^WARNING_BITS} }' 55.55.55.55.45.55.55.55.55.55.55.55.55.55.55.55.55.55.55 % # from which I derive: % perl-v5.32.1 -e 'use warnings; BEGIN { printf "recursion warnings are %senabled\n", (0x10 & ord substr ${^WARNING_BITS}, 4, 1) ? "" : "not " }' recursion warnings are enabled %
        Pel -V?