Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Created April 17, 2015 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FROGGS/25d22b159f3c225993c1 to your computer and use it in GitHub Desktop.
Save FROGGS/25d22b159f3c225993c1 to your computer and use it in GitHub Desktop.
my Mu $sh := nqp::list_s();
my $file = 'TEST_FILE'.IO;
unless $file.e {
my Mu $sc := nqp::createsc('FLUBBER');
my $obj = { foo => 'bar' };
nqp::scsetobj($sc, 0, $obj);
nqp::setobjsc($obj, $sc);
$file.IO.spurt: nqp::p6box_s(nqp::serialize($sc, $sh));
}
my str $serialized = nqp::unbox_s($file.slurp);
my $dsc := nqp::createsc('BLUBBER');
nqp::deserialize($serialized, $dsc, $sh, nqp::list(), nqp::null());
say nqp::scobjcount($dsc);
say nqp::scgetobj($dsc, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment