# New Ticket Created by  Martin Barth 
# Please include the string:  [perl #127869]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127869 >


Hi there,

following code dies in this line:

if my $match = $r.match($meth, $uri) { die "What?!" unless $match }

this happens on both moar-2015.12 and moar-2016.03





class Abc {
    has Str $.method;
    has Regex $.path is required;

    method match (Str $method, Str $path) {
        return False if $.method ne $method;
        return $path ~~ $.path;
    }
}

my @routes = (
    Abc.new(method => "GET", path => / ^ '/'foo $ / );
    Abc.new(method => "POST", path => / ^ '/'bar $ /);
);

sub foo($meth, $uri) {
    for @routes -> $r {
        if my $match = $r.match($meth, $uri) { die "What?!" unless $match }
    }
}

my @hex = ('A'..'F', 'a'..'f', 0..9).flat;
for @hex -> $first {
    for @hex -> $second {
        foo("POST", 'http://127.0.0.1/utf8');
    }
}

Reply via email to