Re: [Catalyst] does detach cancel forward

2009-11-08 Thread Andrew Rodland
On Saturday 07 November 2009 05:30:27 pm Andrew Rodland wrote:
>  out, detach throws an extension that unwinds that whole stack.

Being tired makes me type words that *sound* similar to the one I meant. 
Exception. Not extension. Exception. :)

Andrew

___
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] does detach cancel forward

2009-11-07 Thread Steve Rippl
On Sat, 2009-11-07 at 15:30 -0800, Andrew Rodland wrote:
> On Saturday 07 November 2009 01:08:33 pm Steve Rippl wrote:
> > it's just that I had started thinking
> > in terms of "nested" flow control because that's what I wanted
> (wishful
> > thinking...).  I thought perhaps each forward created a separate
> > nest/level I could detach out of and previous forwards were
> > "remembered", but obviously this isn't the case.
> 
> No, this *is* the case, 100%. Forward is nothing more than a function
> call, so
> you can nest it and you get a call stack. It's just that, as I pointed
> out,
> detach throws an extension that unwinds that whole stack.
> 
Sorry I wasn't clear, I got that it worked that way with forward, what
threw me was I didn't assume that detach unwound the whole stack (until
I saw it behaving that way).  But if I put use eval{$c->forward...) as
Bill suggested then a detach within that gets me back to where I want to
be.  I could probably rework things and remove the detaches I have in
there and just rely on the appropriate forwards, but the eval{} is a
quick solution.

Thanks for clarifying...

___
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] does detach cancel forward

2009-11-07 Thread Andrew Rodland
On Saturday 07 November 2009 01:08:33 pm Steve Rippl wrote:
> it's just that I had started thinking
> in terms of "nested" flow control because that's what I wanted (wishful
> thinking...).  I thought perhaps each forward created a separate
> nest/level I could detach out of and previous forwards were
> "remembered", but obviously this isn't the case.

No, this *is* the case, 100%. Forward is nothing more than a function call, so 
you can nest it and you get a call stack. It's just that, as I pointed out, 
detach throws an extension that unwinds that whole stack.

Andrew

___
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] does detach cancel forward

2009-11-07 Thread Rippl, Steve
On Sat, 2009-11-07 at 12:55 -0800, Bill Moseley wrote:
> 
> 
> On Sat, Nov 7, 2009 at 11:08 AM, Steve Rippl
>  wrote:
> 
> 
> As the noob that started all this I would say that the docs I
> came
> across (the online tutorial and the books) are pretty clear on
> what the
> effects of forward and detach are, it's just that I had
> started thinking
> in terms of "nested" flow control because that's what I wanted
> (wishful
> thinking...).  I thought perhaps each forward created a
> separate
> nest/level I could detach out of and previous forwards were
> "remembered", but obviously this isn't the case.  Maybe just
> something
> stating that this flow control is "flat" in some sense, each
> control
> statement has no notion of previous ones...
> 
> 
> eval { }
>  

Well that works, thanks!!
___
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] does detach cancel forward

2009-11-07 Thread Bill Moseley
On Sat, Nov 7, 2009 at 11:08 AM, Steve Rippl wrote:

>
> As the noob that started all this I would say that the docs I came
> across (the online tutorial and the books) are pretty clear on what the
> effects of forward and detach are, it's just that I had started thinking
> in terms of "nested" flow control because that's what I wanted (wishful
> thinking...).  I thought perhaps each forward created a separate
> nest/level I could detach out of and previous forwards were
> "remembered", but obviously this isn't the case.  Maybe just something
> stating that this flow control is "flat" in some sense, each control
> statement has no notion of previous ones...
>


eval { }


-- 
Bill Moseley
mose...@hank.org
___
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] does detach cancel forward

2009-11-07 Thread Steve Rippl
On Sat, 2009-11-07 at 01:07 -0800, Andrew Rodland wrote:
> Yeah, there are at least two big shortcomings.
> 
> 1. I think that we should stop trying to over-simplify things here, or
> at
> least stop *only* providing a simplified version and tell the truth:
> detach
> forwards, and then it throws an exception. That exception propagates
> up until
> the whole stack of running actions is unwound, and then Catalyst
> catches it
> and continues processing as usual, calling any 'end' action and then
> doing
> 'finalize'.
> 
> 2. There's a "Flow Control" section in Catalyst::Manual::Intro that
> paints a
> better picture than perldoc Catalyst, but someone going directly to
> the docs
> for forward, detach, etc. can easily miss the pointers to
> Catalyst::Manual::Intro. The whole Manual::Intro business is a mess
> that
> nobody wants to touch. I don't know what to do with it either. :)
> 
As the noob that started all this I would say that the docs I came
across (the online tutorial and the books) are pretty clear on what the
effects of forward and detach are, it's just that I had started thinking
in terms of "nested" flow control because that's what I wanted (wishful
thinking...).  I thought perhaps each forward created a separate
nest/level I could detach out of and previous forwards were
"remembered", but obviously this isn't the case.  Maybe just something
stating that this flow control is "flat" in some sense, each control
statement has no notion of previous ones...  

Anyway, thanks to you all for straightening me out!

Steve


-- 
Steve Rippl
Technology Director
Woodland Public Schools
360 225 9451 x326

___
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] does detach cancel forward

2009-11-07 Thread Andrew Rodland
On Wednesday 04 November 2009 04:19:42 pm Ovid wrote:
> Think of detach as "game over", if that helps (probably doesn't).  From the
>  docs, detach() is described as:
> 
> The same as forward, but doesn't return to the previous action when
>  processing is finished.
> 
> I think that description might be a bit confusing for some, as your
>  question suggests.
> 

Yeah, there are at least two big shortcomings.

1. I think that we should stop trying to over-simplify things here, or at 
least stop *only* providing a simplified version and tell the truth: detach 
forwards, and then it throws an exception. That exception propagates up until 
the whole stack of running actions is unwound, and then Catalyst catches it 
and continues processing as usual, calling any 'end' action and then doing 
'finalize'.

2. There's a "Flow Control" section in Catalyst::Manual::Intro that paints a 
better picture than perldoc Catalyst, but someone going directly to the docs 
for forward, detach, etc. can easily miss the pointers to 
Catalyst::Manual::Intro. The whole Manual::Intro business is a mess that 
nobody wants to touch. I don't know what to do with it either. :)

Andrew

___
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] does detach cancel forward

2009-11-07 Thread David Schmidt
>From the new Catalyst Book:

"$c->forward returns to the calling action and ompletes the request,
while $c->detach proceeds to the end action after the called actions
are completed."


On Wed, Nov 4, 2009 at 11:19 PM, Ovid  wrote:
> - Original Message 
>
>> From: Steve Rippl 
>>
>> I'm building "chains" of methods using forward and detach mostly, I
>> quote the chains because I know it's not the regular chained methods but
>> my "chains" vary according to where you are etc.  Anyway, the question I
>> have is whether forward is still valid after a detach... let me
>> illustrate...
>>
>> If A forwards to B, once B is done it comes back to A, that I use and it
>> works.  If C detaches to D to doesn't come back after D, again I use
>> that.
>>
>> Now, If from A I forward to B, then B detaches to C which detaches to D,
>> it doesn't seem to come back to A after D.  Is this my mistake
>> somewhere, is it by design?  Does the detach after a forward "cancel"
>> the forward?
>
> Think of detach as "game over", if that helps (probably doesn't).  From the 
> docs, detach() is described as:
>
>    The same as forward, but doesn't return to the previous action when 
> processing is finished.
>
> I think that description might be a bit confusing for some, as your question 
> suggests.
>
> Cheers,
> Ovid
> --
> Buy the book         - http://www.oreilly.com/catalog/perlhks/
> Tech blog            - http://use.perl.org/~Ovid/journal/
> Twitter              - http://twitter.com/OvidPerl
> Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
>
>
>
> ___
> 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/
>



-- 
David Schmidt   |   http://www.fm5.at

___
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] does detach cancel forward

2009-11-04 Thread Ovid
- Original Message 

> From: Steve Rippl 
>
> I'm building "chains" of methods using forward and detach mostly, I
> quote the chains because I know it's not the regular chained methods but
> my "chains" vary according to where you are etc.  Anyway, the question I
> have is whether forward is still valid after a detach... let me
> illustrate...
> 
> If A forwards to B, once B is done it comes back to A, that I use and it
> works.  If C detaches to D to doesn't come back after D, again I use
> that.  
> 
> Now, If from A I forward to B, then B detaches to C which detaches to D,
> it doesn't seem to come back to A after D.  Is this my mistake
> somewhere, is it by design?  Does the detach after a forward "cancel"
> the forward?

Think of detach as "game over", if that helps (probably doesn't).  From the 
docs, detach() is described as:

The same as forward, but doesn't return to the previous action when 
processing is finished.
 
I think that description might be a bit confusing for some, as your question 
suggests.

Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog- http://use.perl.org/~Ovid/journal/
Twitter  - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6



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


[Catalyst] does detach cancel forward

2009-11-02 Thread Steve Rippl
Hi all.

I'm building "chains" of methods using forward and detach mostly, I
quote the chains because I know it's not the regular chained methods but
my "chains" vary according to where you are etc.  Anyway, the question I
have is whether forward is still valid after a detach... let me
illustrate...

If A forwards to B, once B is done it comes back to A, that I use and it
works.  If C detaches to D to doesn't come back after D, again I use
that.  

Now, If from A I forward to B, then B detaches to C which detaches to D,
it doesn't seem to come back to A after D.  Is this my mistake
somewhere, is it by design?  Does the detach after a forward "cancel"
the forward?

Thanks,
Steve


-- 
Steve Rippl
Technology Director
Woodland Public Schools
360 225 9451 x326

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