On Wed, Nov 27, 2013 at 02:51:23PM +0000, Craig Chant wrote:
So I assume
$c->controller('ComplianceUpdate')->action_for('index');
is returning an action object that is passed to detach.
True.
However, your example just has a string path '/a/my_action_1' , how is that
an action object?
It's not :) Catalyst magically converts that for you.
See this:
https://metacpan.org/source/JJNAPIORK/Catalyst-Runtime-5.90051/lib/Catalyst/Dispatcher.pm#L148
It either gets an action object, or it translates the path to an object for
you.
Having just tested with:
$c->detach('/complianceupdates/index');
is working.
So the question now is which is better...
$c->controller('ComplianceUpdate')->action_for('index');
or
$c->detach('/complianceupdates/index');
Pass a string or a pass an object?
I like the string option better. It's cleaner to read. But you should be fine
with both.
Cheers,
André
_______________________________________________
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/