Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement