Re: [Catalyst] Can't seem to use forward or detach. Any special requirements?

2009-04-25 Thread oliver . g . charles
kakim...@tpg.com.au wrote:
 hello, all,

  I have a method in my controller which adds entries.

  The method is setup to match the path of 'users/subscriptions/add'.

  Upon successfully adding entries, I want the same method to be executed
 again (only that the method will know which template (view) to call. I
 tried using a detach (and even a forward) and I keep getting an error of
 , 'Couldn't forward to command /users/subscriptions/add: Invalid
 action or component.'

This is because the  path you specified is not the internal path
name to the action (that is whatever you named your controller /create),
but it is the external path. Detach works on internal path names.

 Reason why I am issuing a detach - To prohibit users from pressing
 Refresh on the browser which will cause the application to readd the
 entry again into the database (this happens because I suspect that the
 request object is not flushed. I could easily kill off the parameters in
 the request object but I figured I use a detach and have another (view)
 template show up.

Detach will simply cause another action to be executed before returning
to the browser, so this won't solve your problem. You need to cause a
redirect to solve your problem, so the correct code would be:

$c-res-redirect($c-uri_for_action('/controller/create')

Where controller is the name of the controller that contains the action
you provided in your email.

Hope that helps

--
Oliver Charles / aCiD2

___
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/


Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?

2009-04-22 Thread oliver . g . charles
kakim...@tpg.com.au wrote:
Good morning. I am interested in hearing more about this.
 IMO the best place for your business logic is the controller.
 A view is made out of the html (usually templated with a templating
 system such as template toolkit).

I believe the main suggestion is not to move the logic into another part
of MVC, it's to move it *out* of MVC completely. A well structured
Catalyst application will have MVC for Catalyst that are all just glue
to your applications backend - which should be totally independant of
Catalyst.

--
Oliver Charles / aCiD2

___
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/