perl5i
(
M/MS/MSCHWERN/perl5i-v2.13.2.tar.gz, MSCHWERN, 2016;
MetaCPAN
)
my %args = @_;
my $format = $args{format} // "perl";
state $dumpers = {
json => "as_json",
yaml => "as_yaml",
perl => "as_perl",
};
my $dumper = $d
for dump()") unless $dumper;
return $self->$dumper(%args);
}
sub as_json {
require JSON::MaybeXS;
my $json = JSON::MaybeXS->new
->utf8
->pretty
sed;
# JSON doesn't seem to have an easy way to say
# "just dump objects as references please". This is their
# recommended way to do it (yarf).
local *UNIVERSAL::TO_JSON = sub {