# New Ticket Created by Timothy Bollman # Please include the string: [perl #130940] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130940 >
If you pass an undefined value into starts-with, it loops forever because the Cool class has a wrapper method that casts the parameters to Str then invokes that. The Str class, however, defines the method as only taking a defined string. So it matches the Cool method again. Repeat. Changing the cool variant to only take a defined value causes it to die with an error message which is infinitely better: multi method starts-with(Cool:D: Str(Cool:D) $needle). Or you could make a Str variant that returns some stock value. I don't really know nor care what the intended behavior is as long as it doesn't loop infinitely. From what I've seen in languages I have installed, the majority give an exception or otherwise crash and perl5 obviously treats it as the empty string. I presume there's a whole category of these in the Cool class that need the same treatment (like ends-with and contains).