[Catalyst] Can't seem to use forward or detach. Any special
requirements?
kakimoto at tpg.com.au
kakimoto at tpg.com.au
Mon Apr 27 12:55:52 GMT 2009
Hello, J. Shirley,
Thank you for your explaination. It made things much clearer and
confirmed a lotta things.
One last trivial question:
> A redirect is to a URI, composed of however you make it. If you
> preserve
> the request parameters, they will be there. All you are doing is
> sending a
> string to the web browser, that the web browser will then go to
> next.
How do you mean by 'preserve the request parameters'? Does it mean by
not having source code that would mutate the request parameter arguments?
I 'd like to add another piece of information which I read from J
Rockway's book.
When executing a redirection, stash values do not persist. To make that
happen, we have to
1) store the stash intended values to the flash
2) make sure flash_to_stash enabled (ie __PACKAGE__->config(session => {
flash_to_stash => 1} );
If I have missed something here, kindly let me know.
Thank you guys (esp J Shirley).
K. akimoto
Quoting "J. Shirley" <jshirley at gmail.com>:
> On Mon, Apr 27, 2009 at 9:07 PM, <kakimoto at tpg.com.au> wrote:
>
> > Hi, everyone,
> > I know that most people here would understand redirect, forward
> and
> > detach well.
> > Unfortunately, there are people like myself who don't understand it
> that
> > well and hence, after looking at the CPAN catalyst docs and
> J.Rockway's
> > book, still fail to find a page that defines these methods and
> > differentiates them clearly.
> >
> > i hope someone can help shed some light here. Here it goes:
> >
> > Looking at the doc for Catalyst::Response->redirect (
> >
> >
>
http://search.cpan.org/~flora/Catalyst-Runtime-5.80002/lib/Catalyst/Response.pm#$res-%3Eredirect(_$url,_$status_)<http://search.cpan.org/%7Eflora/Catalyst-Runtime-5.80002/lib/Catalyst/Response.pm#$res-%3Eredirect%28_$url,_$status_%29>
> > ),
> >
> > can anyone tell me
> >
> > - do the request parameters still stay when redirected?
> > - how about the stash values? do they persist after the
> redirection? I
> > do not think so but it's good to have some confirmation.
> > - "This is a convenience method that sets the Location header to
> the
> > redirect destination, and then sets the response status. You will
> want
> > to return; or $c-detach() > to interrupt the normal processing
> flow
> > if you want the redirect to occur straight away" - Could anyone
> please
> > give some examples of this?
> >
> > do we do something like:
> >
> > $c->res->redirect ($c->uri_for('subscriptions/confimation'));
> > return 0;
> >
> > or something?
> >
> >
> >
> > thanks!
> >
> > k. akimoto
> >
> > _______________________________________________
> > 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/
> >
>
>
> STOP. TOP. POSTING.
>
> Put your reply BELOW. Like everybody else here, and is the
> documented list
> standard.
>
> forward and detach have absolutely nothing in common with a
> redirect.
>
> forward and detach are internal Catalyst actions. It tells Catalyst,
> "Go
> here".
>
> Redirect is an HTTP *Response*. It tells the browser, "Look over
> here".
>
> A redirect is to a URI, composed of however you make it. If you
> preserve
> the request parameters, they will be there. All you are doing is
> sending a
> string to the web browser, that the web browser will then go to
> next.
>
> Calling $c->res->redirect does not stop processing. To stop
> processing, you
> have to call $c->detach.
>
> This code example:
> $c->res->redirect('http://google.com');
> $c->log->debug('Hello');
>
> will print "Hello" to the log. If you have something important after
> the
> redirect call, it will be executed. That is the point of the warning
> in the
> documentation.
>
> And please...
>
> STOP. TOP. POSTING.
>
> Put your reply BELOW. Like everybody else here, and is the
> documented list
> standard.
>
> -J
>
More information about the Catalyst
mailing list