Re: [Mojolicious] Re: Test Existence of Key in Session Hash Without Creating Element

2019-01-10 Thread Viktor Nacht
Ugh, you nailed it. I found a spot in my code that suffered from 
autovivification. Thank you. 

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Re: Test Existence of Key in Session Hash Without Creating Element

2019-01-10 Thread Dan Book
It is just a hash at that point so none of those things should cause that.
But if you accessed $c->session->{order}{anything} it would create a hash
due to autovivification.

-Dan

On Thu, Jan 10, 2019 at 10:23 PM Viktor Nacht 
wrote:

> *sigh* I meant:
>
> {"expires":1547178562,"order":{}}
>
> --
> 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 mojolicious+unsubscr...@googlegroups.com.
> To post to this group, send email to mojolicious@googlegroups.com.
> 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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Test Existence of Key in Session Hash Without Creating Element

2019-01-10 Thread Viktor Nacht
*sigh* I meant:

{"expires":1547178562,"order":{}}

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Test Existence of Key in Session Hash Without Creating Element

2019-01-10 Thread Viktor Nacht
So if you do something like:

if ($c->session->{order}) {
 # process order
}

The session cookie looks something like this:

{"expires":1547178562,"cart":{}}

Is there a way to test for the existing of keys in the session has that 
won't cause it to string into existence? Using 'exists' or 'defined' has 
the same problem. I understand why, but I'm not sure how people get around 
that unless it's to work more directly with the cookie.

Thanks!

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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.