A lexical variable is still bound to a scope, even if it's the file scope. If that scope is run again (such as creating another instance of the same application) then that will have a separate instance of that lexical variable. State variables are initialized once and shared between any access for the rest of that process. It can't know what outer scope you might have wanted to store it in. It can still be useful but you have to make sure that's what you want.
-Dan On Wed, May 8, 2019 at 11:45 PM Veesh Goldman <[email protected]> wrote: > > > On Wed, May 8, 2019, 5:55 PM Dan Book <[email protected]> wrote: > >> >> Alternatively you can use 'state $sqlite = ' inside the helper but this >> approach breaks the ability to run multiple separate apps in the same >> process, because it will make one $sqlite per whole process. >> >> -Dan >> > > > Could you expound on this problem? I thought state is just a shortcut to > closing over a lexical variable. > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mojolicious/CAO-W_8CVM9NnBMXuyvHi_FCT7p8%2B11FxTn6it9%3D%3D2JpUr78nfw%40mail.gmail.com > <https://groups.google.com/d/msgid/mojolicious/CAO-W_8CVM9NnBMXuyvHi_FCT7p8%2B11FxTn6it9%3D%3D2JpUr78nfw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > 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. To view this discussion on the web visit https://groups.google.com/d/msgid/mojolicious/CABMkAVUWJc-rYw4DhThw9YGcp7OdCh3d0djXRoPLpRkq-vESZg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
