> Leszek wrote: >> Simply speaking: page local is a special variable that has different >> values in different continuations. > > So it seems that a continuation by default only saves the "program > counter" (or equivalent notion in JS) but not the local variables. > This is a bit counter-intuitive, and blatantly against the > documentation[1], but you clearly explained the reasons behind it. > > What about global variables? > And the parameters of a (recursive) function call? > > I have run a little test and frankly I don't understand what's > happening any more. > > var called = 0 > > function f(x) { > called++ > cocoon.sendPageAndWait('test', { x: x, called: called }) > f(x + 1) > } > > function called_from_sitemap() { > f(1) > } > > called is a global variable. There is a sitemap matcher that calls > called_from_sitemap(), which in turn calls f(1), which calls f(2), etc. > > Every new call to f() increments called (which should grow on par with > the stack of x parameters) and sends both variables to 'test', which is: > > <html> > <body> > <p> x = ${x} </p> > <p> called ${called} times </p> > <p> <a href="cont=${continuation.id}">next</a> </p> > </body> > </html> > > The cont=* pipeline calls the continuation. > > Following the 'next' links, I expected to see: > x = 1, called 1 times > x = 2, called 2 times > x = 3, called 3 times > > At which point I would start playing with the continuations, going back > and forth. Instead I get: > x = 1, called 1 times > x = 1, called 1 times > x = 1, called 1 times >
Toby-- Your example got me curious, since it should indeed work as your expectation. So I tried out your sample code and it does in fact increment the values. Something else must be going wrong with your setup. Are you sure you're actually calling the continuation rather than starting the flow over each time? I'm not familiar with the <a href="cont=${continuation.id}"> format, is that even a valid URL?. When I use href="${continuation.id}.continue" and of course have a matcher in the sitemap for that pattern, it works correctly. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]