by kbenson · 9y ago · 0 comments
That said, I see promise with this. I use Data::Dump with a custom handler to make dumping of DateTime and specific DBIC subclass objects much more palatable based on whether the current item being recursed's ISA. e.g. 'sprintf "%s [%s]", $_[1], $_[1]->time_zone->name' for DateTime objects.
Having that abstracted away into a module with plugins would simplify that quite a bit.
1: Non-working tersification: # perl -E 'use strict; use warnings; use Data::Dumper; use Data::Tersify qw(tersify); use Data::Tersify::Plugin::DateTime; use DateTime; my $dt = DateTime->now; say "### RAW ###"; say $dt; say "\n\n### DUMPER ###"; say Dumper($dt); say "\n\n### TERSIFIED ###"; say Dumper(tersify($dt));'
So instead of…
Dumper(tersify($dt))
You would want to try… Dumper(tersify({ now => $dt }))I'm not sure the reasoning behind that behavior. Presumably if you don't want it tersified, you don't pass it to tersify, and just pass it to your dumper function directly.