Hi, not sure if this is what you need, but I wrote an example on how to trigger some state machine with a post request, and later be able to check some status with other requests:
https://github.com/dmanto/mojo-stateful-server-experiment/blob/master/stateful.pl Hope it can help BR, Daniel El lunes, 19 de noviembre de 2018, 23:01:26 (UTC-3), Dan Book escribió: > > A 'state' variable lasts for the rest of that process, but is only > available to the scope it's declared in. If you want per-connection (or > more precisely per request), I recommend storing it in the stash, like: > > helper foo => sub { > my $c = shift; > return $c->stash->{'myapp.foo'} //= ...; > }; > > -Dan > > On Mon, Nov 19, 2018 at 8:18 PM Viktor Nacht <[email protected] > <javascript:>> wrote: > >> Does using state inside a helper last for the duration of the connection, >> or something longer lasting like a process, worker, etc? >> >> I want to create (and return) a current DateTime object and make it >> accessible to multiple helpers and templates during a connection. >> >> I saw this Gist, but I'm not sure it pertains to per-connection: >> >> https://gist.github.com/s1037989/179d53b86e46ae788f62 >> >> V >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
