Parse attributes with empty parens as undef
Thomas Sibley [Fri, 6 Nov 2015 02:55:27 +0000 (18:55 -0800)]
This fixes parsing of Path() to be the same as Path, resolving GH #104,
without breaking Args().

lib/Catalyst/Controller.pm

index d0a8570..0203b29 100644 (file)
@@ -399,7 +399,7 @@ sub _parse_attrs {
 
         # Parse out :Foo(bar) into Foo => bar etc (and arrayify)
 
-        if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.+?)\s*\))?$/ ) )
+        if ( my ( $key, $value ) = ( $attr =~ /^(.*?)(?:\(\s*(.+?)?\s*\))?$/ ) )
         {
 
             if ( defined $value ) {