Add timestamp to item (back-end TO_JSON)
Route exception: encountered object '2015-06-08T16:08:05', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing
Run the tests
snippets/10/test_output.txt
$ perl Makefile.PL $ make $ make test t/v2.t ............... 1/4 [D2::Ajax:31818] error @2015-06-08 16:16:58> Route exception: encountered object '2015-06-08T16:16:57', but neither allow_blessed, convert_blessed nor allow_tags settings are enabled (or TO_JSON/FREEZE method missing) at /Users/gabor/work/D2-Ajax/blib/lib/D2/Ajax.pm line 71. in /Users/gabor/perl5/perlbrew/perls/perl-5.22.0_WITH_THREADS/lib/site_perl/5.22.0/Return/MultiLevel.pm l. 36 malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<!DOCTYPE html PUBLI...") at t/v2.t line 67. # Child (v2_items) exited without calling finalize()
snippets/10/prove.txt
$ prove -vl t/v2.t ok 1 - v2_greeting ok 2 - v2_reverse # { # 'items' => [ # { # '_id' => { # '$oid' => '5575974aa114607c78523711' # }, # 'date' => 'DateTime', # 'text' => 'First Thing to do' # } # ] # } ok 3 - v2_items ok 4 - no warnings ok All tests successful. Files=1, Tests=4, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.45 cusr 0.12 csys = 1.62 CPU) Result: PASS
Tell MongoDB to use DateTime::Tiny
$client->dt_type( 'DateTime::Tiny' );
snippets/10/prove2.txt
$ prove -vl t/v2.t ok 1 - v2_greeting ok 2 - v2_reverse # { # 'items' => [ # { # '_id' => { # '$oid' => '557598d0a114607c945d5021' # }, # 'date' => 'DateTime::Tiny', # 'text' => 'First Thing to do' # } # ] # } ok 3 - v2_items ok 4 - no warnings ok All tests successful. Files=1, Tests=4, 3 wallclock secs ( 0.05 usr 0.01 sys + 1.52 cusr 0.15 csys = 1.73 CPU) Result: PASS