Basically the problem is that Safe creates a new environment and the class into which your data has been blessed is not the same class that exists in our normal environment.

use Safe; use Devel::Peek; my $r = 'bless \\ do { my $x = 0 }, "x"'; print Dump(eval $r); print Dump(Safe->new->reval($r)); print Dump(eval $r); print Dump(Safe->new->reval($r));

Which outputs (on my machine at least):

SV = RV(0x1847158) at 0x1830630 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x182fa48 SV = PVMG(0x18a9974) at 0x182fa48 REFCNT = 1 FLAGS = (PADBUSY,PADMY,OBJECT,IOK,pIOK) IV = 0 NV = 0 PV = 0 STASH = 0x18d8620 "x" SV = RV(0x1847188) at 0x18d8b24 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x18d8b00 SV = PVMG(0x18a8f34) at 0x18d8b00 REFCNT = 1 FLAGS = (PADBUSY,PADMY,OBJECT,IOK,pIOK) IV = 0 NV = 0 PV = 0 STASH = 0x18d8b54 "x" SV = RV(0x1847180) at 0x18d88fc REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x18d8920 SV = PVMG(0x18a90f4) at 0x18d8920 REFCNT = 1 FLAGS = (PADBUSY,PADMY,OBJECT,IOK,pIOK) IV = 0 NV = 0 PV = 0 STASH = 0x18d8620 "x" SV = RV(0x1847188) at 0x18d8b18 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x18d8a28 SV = PVMG(0x18a90f4) at 0x18d8a28 REFCNT = 1 FLAGS = (PADBUSY,PADMY,OBJECT,IOK,pIOK) IV = 0 NV = 0 PV = 0 STASH = 0x18d8b90 "x"

Notice how the stash has the same address for both the first and third runs. The second and fourth entries (those that are both from new Safe environments) have stashes where the address does not match either. This is because the x namespace in our environment is not the same as the one in either of the Safe compartments we created. I'm curious which version of CGI::Session you are using since I submitted a crummy fix that walks the structure and reblesses everything in place in the 4.x version (__walk in CGI::Session::Serialize::default).


In reply to Re: CGI::Session cannot read data from Data::Dumper by !1
in thread CGI::Session cannot read data from Data::Dumper by lom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.