DateTime-Format-Lite
view release on metacpan or search on metacpan
t/85.serialisation.t view on Meta::CPAN
if( !eval{ require JSON; 1 } )
{
skip( 'JSON module not available', 3 );
}
my $orig = _make_fmt();
my $json_str = JSON::encode_json( $orig->TO_JSON );
ok( defined( $json_str ), 'JSON encode succeeded' );
my $state = JSON::decode_json( $json_str );
ok( ref( $state ) eq 'HASH', 'decoded JSON is a hashref' );
# Reconstruct from the decoded state
my $restored = DateTime::Format::Lite->new( %$state );
ok( defined( $restored ), 'reconstruct from JSON state succeeded' );
_check_state( $orig, $restored, 'JSON' );
};
};
done_testing;
__END__
( run in 4.068 seconds using v1.01-cache-2.11-cpan-600a1bdf6e4 )