[Catalyst] soliciting feedback for alternative method attributes syntax

John Napiorkowski jjn1056 at yahoo.com
Tue Jan 12 15:13:11 GMT 2016


On Monday, January 11, 2016 7:30 AM, Hartmaier Alexander <alexander.hartmaier at t-systems.at> wrote:

Hi John,
the first question that came to my mind was: Why is it called At, both the module as well as the method attribute?
-----Thanks for taking the time here, its really helpful!  Obviously I can always write something that makes total sense to me, but unless other people look at it and discuss I can't make it something that makes sense to others (or decide if its worth doing at all...)
'At' I chose because I wanted the shortest possible thing that I think conveyed  enough information to describe what it was doing.  I find with my actions when I have subroutine signatures, complex routing and a few action roles I end up with a very very long subroutine preamble.  Part of my motivation is to make it shorter but not at the expense of understanding.  is "At" too meaningless? -----
The 'Naming your Arguments' section is confusing because it populates a variable named '$id' but uses '$_{id}' for the response.
I understand that you want to show that the args get passed to the sub like in core Catalyst but I'd do that in a second example as the preferred way to do it with this module would be $_{id}.
----- I'll try to redo that bit to disambiguate better.  Part of me is not 100% convinced $_{NamedArg} is great for Catalyst.  So I am still thinking it over.-----
I'd prefer to use the (experimental) subrouting signature feature of Perl 5.20 than $_{id} which also doesn't have the same API as Perl 5.10 named regex capture patterns ($+{id}).
-----Since my Catalyst stuff tries to be backcompat to 5.8.x and avoids anything marked experimental, and not widely seen on CPAN, I'd just use the classic form, but I think there's nothing stopping people from using something else right?-----
An example how to allow literal {  and } in a URL should be added (and the feature if that doesn't exist).
-----Awesome, will do that, and write a test case for it.-----
The example in 'Matching GET parameters' is incorrect, the full-uri should be'https://fqdn/example/query?name=john;age=47'.
Would it also match any order of the parameters like 'https://fqdn/example/query?age=47;name=john'? I didn't find this in the Catalyst::ActionRole::QueryParameter docs.
-----Since query params are not supposed to be ordered, the example works either way.  I know some frameworks use hacks to allow ordering, but its explicitly in the RFC that the order is not to be considered meaningful.  I'll fix the typo, thanks!-----
That might be a stupid question because I don't know the internal workings but could it be called 'Chained' instead of 'Via' so if someone want's to convert the route matching to this module (s)he doesn't have to rewrite as much?
-----Again this is me looking for something shorter, but I could probably overload it to allow either Via or Chained.  I just always found that Chained being used to express root, midpoints and endpoints to be a little too much semantic polymorphism :)-----
I think I like the parameter type matching and extraction more than the different syntax but I'm no good measure because I've grown up with Chained ;)
-----The thing is if the classic Chained stuff works for you, I'm glad, and this is probably not aimed at you.  I've just heard from literally dozens of people that they don't understand chaining, often ban in in the code, and there's a lot of confusion as to when to using Chaining versus 'classic' attributes.  In general I've noted that the attribute based URL mapping caused a ton of trouble for people and just want to experiment with ideas that might make it easier for that group.  Thanks!-----
Cheers, Alex


On 2016-01-08 00:41, John Napiorkowski wrote:

Lots of people tell me the hardest thing about catalyst is the method attributes used to describe routes, particularly chaining.  Here's a sketch for an alternative syntax that encompasses chaining along with more simple routes.
>
>
>jjn1056/Catalyst-ControllerRole-At
>
>  
>            
>jjn1056/Catalyst-ControllerRole-At
>Catalyst-ControllerRole-At - Alternative was to describe Catalyst URL matching paths. 
>
> 
>View on github.com Preview by Yahoo 
>
> 
>  
>
>
>the SYNOPSIS bit is still WIP so ignore it, but the rest of the docs are proposed final.  There's no code for this yet, just docs, I'm looking for feedback on 'is this easier to understand'.  
>
>
>Critique welcome, if constructive.  I know lots of people don't like the method attribute stuff, but I'm not doing any work on that right now, so constructive critique means not saying you'd prefer something other than method attributes :) I already hear that, but this is something that can layer as sugar on top of the existing work, or even mixed into an existing project.  I'm trying to split the difference between usefully different and alien brains difference.  Thanks
>
>
>Jnap
>
>
>_______________________________________________
List: Catalyst at lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ 

-- LG Alex 

*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
 

_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20160112/3b844de3/attachment.htm>


More information about the Catalyst mailing list