Last active
August 29, 2015 14:07
-
-
Save ziguzagu/3afa745473cf28eaf831 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use Mojo::JSON qw(j); | |
use Storable qw(thaw nfreeze); | |
use Data::Dumper; | |
use Symbol qw(delete_package); | |
my $json = j('{"boolean":true,"string":"this is string"}'); | |
warn Dumper($json); | |
my $bin = nfreeze($json); | |
## suppose in other process/program it doesn't load Mojo::JSON | |
delete_package('Mojo::JSON'); | |
warn Dumper(thaw($bin)); | |
# ✘ perl mojojson-storable.pl | |
# $VAR1 = { | |
# 'boolean' => bless( do{\(my $o = 1)}, 'Mojo::JSON::_Bool' ), | |
# 'string' => 'this is string' | |
# }; | |
# Can't locate Mojo/JSON/_Bool.pm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment