... do I need to hang myself? I'm (finally) playing around with chained, and like it very much. But now I have some sort of design question, on which I'd like to collect some feedback:
Say, you want to edit things. The general way of editing is the same for most things, only the thingies you want to edit differ (i.e. their fields). (slightly OT, but some background: We want to use HTML::FormFu for actual form generation, but do not want to use the config-file aproach, but something like a 'registry' where each field and it's definition is stored (basically we have several different things using similar fields...)) What to you think is better: A) lots of chain package Thing: use base 'Generic'; sub base : Chained('/') PathPart('thing') CaptureArgs(0) {} sub setup_fields : Chained('item') CaptureArgs(0) { # define a list of fields and store them in stash } package Generic; sub item : Chained('base') PathPart('') CaptureArgs(1) { # load thing and store in stash } sub show_form : Chained('setup_fields') Args(0) { # take field list, make form, etc } I'd end up with an URL like /thing/123/setup_fields/show_form B) Plain Old Methods package Thing: use base 'Generic'; sub base : Chained('/') PathPart('thing') CaptureArgs(0) {} sub edit : Chained('item') Args(0) { my ($self, $c) = @_; $self->setup_fields($c, ... ); $self->make_form; # } package Generic; sub item : Chained('base') PathPart('') CaptureArgs(1) { # load thing and store in stash } sub setup_fields {} sub make_form {} sub handle_form {} I'd end up with an URL like /thing/123/edit which IMO looks nicer. So, is A) just overdoing chained? B) looks ok, but is it using chained to it's full potential? I'd really like to hear some of your thoughts... -- #!/usr/bin/perl http://domm.plix.at for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/} _______________________________________________ List: Catalyst@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/