Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^5: Is it safe to use external strings for regexes? (infinite loops)

by LanX (Saint)
on Oct 11, 2021 at 22:45 UTC ( [id://11137436]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Is it safe to use external strings for regexes? (infinite loops)
in thread Is it safe to use external strings for regexes?

While I like that Perl doesn't allow this to block the engine, I'm not too sure about the solution.

Ignoring regex grammar to silently continue might be worse than throwing an explicit warning.

    Regex-Problem: Empty match detected, trying continuation...

Alike the "deep recursion" warning if Perl dives 100 times deep into the same sub.

But I don't think I know the RE algebra good enough to tell.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

update

s/1000/100/

  • Comment on Re^5: Is it safe to use external strings for regexes? (infinite loops)

Replies are listed 'Best First'.
Re^6: Is it safe to use external strings for regexes? ("deep recursion" in Debugger)
by LanX (Saint) on Oct 12, 2021 at 09:31 UTC
    hippo messaged me that

    > FYI, the default recursion limit is "only" 100.

    I knew, but when in tested in the debugger I only saw

    1000 levels deep in subroutine calls!

    It seems that the debugger has a hard breakpoint at 1000 and doesn't show the normal "deep recursion" warning.

    Tested with 5.32 on Win.

    FWIW:

    use strict; use warnings; our $limit =1050; our $l=0; sub tst { $l++; #warn "level: $l" unless $l%50; die "LIMIT $limit reached" if $l>$limit; tst(); } tst();
    in debugger
    D:\tmp\pm>perl -d tst_recursion.pl Loading DB routines from perl5db.pl version 1.57 Editor support available. Enter h or 'h h' for help, or 'perldoc perldebug' for more help. main::(tst_recursion.pl:4): our $limit =1050; DB<1> c main::tst(tst_recursion.pl:9): $l++; 1000 levels deep in subroutine calls! DB<1>

    normal run

    D:\tmp\pm>perl tst_recursion.pl Deep recursion on subroutine "main::tst" at tst_recursion.pl line 12. LIMIT 1050 reached at tst_recursion.pl line 11. D:\tmp\pm>

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found