{"action":"closed","issue":{"url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1191","repository_url":"https://api.github.com/repos/PerlDancer/Dancer2","labels_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1191/labels{/name}","comments_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1191/comments","events_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1191/events","html_url":"https://github.com/PerlDancer/Dancer2/issues/1191","id":161106970,"number":1191,"title":"Nammed capture regex messing with the routing engine","user":{"login":"pierre-vigier","id":7546757,"avatar_url":"https://avatars.githubusercontent.com/u/7546757?v=3","gravatar_id":"","url":"https://api.github.com/users/pierre-vigier","html_url":"https://github.com/pierre-vigier","followers_url":"https://api.github.com/users/pierre-vigier/followers","following_url":"https://api.github.com/users/pierre-vigier/following{/other_user}","gists_url":"https://api.github.com/users/pierre-vigier/gists{/gist_id}","starred_url":"https://api.github.com/users/pierre-vigier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierre-vigier/subscriptions","organizations_url":"https://api.github.com/users/pierre-vigier/orgs","repos_url":"https://api.github.com/users/pierre-vigier/repos","events_url":"https://api.github.com/users/pierre-vigier/events{/privacy}","received_events_url":"https://api.github.com/users/pierre-vigier/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-20T02:36:31Z","updated_at":"2016-10-06T20:53:25Z","closed_at":"2016-10-06T20:53:25Z","body":"Hi,\r\n\r\nin a test script, i was exposed to some strange behavior when parsing a response with a nammed capture regex. After using the regex, all the requests were defaulted to the same route. Scoping the regex solved the issue.\r\nI wrote a small piece of code to show case the issue.\r\n\r\n```perl\r\npackage app;\r\nuse Dancer2;\r\nget '/1' => sub {\r\n    return '1';\r\n};\r\nget '/2' => sub {\r\n    return '2';\r\n};\r\npackage main;\r\nuse Plack::Test;\r\nuse HTTP::Request;\r\n\r\nmy $test = Plack::Test->create( app->to_app );\r\nmy $request  = HTTP::Request->new( GET => 'http://localhost/1' );\r\nmy $response = $test->request( $request );\r\nprint $response->content, \"\\n\";\r\n\"12345\" =~ m#(?<capture>23)#;\r\nmy $c = $+{capture};\r\n$request  = HTTP::Request->new( GET => 'http://localhost/2' );\r\n$response = $test->request( $request );\r\nprint $response->content, \"\\n\";\r\n```\r\n\r\nThat piece of code is display\r\n```\r\n1\r\n1\r\n```\r\n\r\nIf i use a regex without nammed capture, it is then working correctly\r\n```perl\r\n\"12345\" =~ m#(23)#;\r\nmy $c = $1\r\n```\r\n\r\nIf i scope the regex part, it's working as well\r\n```perl\r\n{\r\n    \"12345\" =~ m#(?<capture>23)#;\r\n    my $c = $+{capture};\r\n}\r\n```\r\n\r\nBoth of those version display 1 and then 2 as expected.\r\n\r\nI can reproduce on Dancer2 0.166001 and Dancer2 0.200001 , the problem is present on perl 5.16.3 and 5.24.0 , i did not try other version of perl.\r\n\r\nPierre"}}
{"actor":{"display_login":"xsawyerx"}}