Awesome, thanks for demystifying this for me!
# go to a string path ("/foo/bar/gorch")
# or action object
if (blessed($command) && $command->isa('Catalyst::Action')) {
$action = $command;
}
else {
$action = $self->_invoke_as_path( $c, "$command", \@args );
}
I'm still at a loss why when I was using the wrong syntax, it was working for
SplashScreen, but the same syntax for ComplianceUpdates wasn't!
And I still can't find where in the docs/tutorial any of this is explained? (a
section and page number would be helpful!)
Regards,
Craig.
-----Original Message-----
From: André Walker [mailto:[email protected]]
Sent: 27 November 2013 15:46
To: The elegant MVC web framework
Subject: Re: [Catalyst] Can't detach from root / create action object
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: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
This Email and any attachments contain confidential information and is intended
solely for the individual to whom it is addressed. If this Email has been
misdirected, please notify the author as soon as possible. If you are not the
intended recipient you must not disclose, distribute, copy, print or rely on
any of the information contained, and all copies must be deleted immediately.
Whilst we take reasonable steps to try to identify any software viruses, any
attachments to this e-mail may nevertheless contain viruses, which our
anti-virus software has failed to identify. You should therefore carry out your
own anti-virus checks before opening any documents. HomeLoan Partnership will
not accept any liability for damage caused by computer viruses emanating from
any attachment or other document supplied with this e-mail. HomeLoan
Partnership reserves the right to monitor and archive all e-mail communications
through its network. No representative or employee of HomeLoan Partnership has
the authority to enter into any contract on behalf of HomeLoan Partnership by
email. HomeLoan Partnership is a trading name of H L Partnership Limited,
registered in England and Wales with Registration Number 5011722. Registered
office: Pharos House, 67 High Street, Worthing, West Sussex, BN11 1DN. H L
Partnership Limited is authorised and regulated by the Financial Conduct
Authority.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/