S
How to generate JSON (albeit with very naive string quoting) using
multimethods:
use v5.20;
use strict;
use warnings;
use experimental 'signatures';
package My::JSON {
use Moo;
), sort keys %$hash,
)
);
},
);
}
my $json = My::JSON->new;
say $json->stringify( {
foo => 123,
bar => [ 1, 2, 3 ],
baz => \1,
quux
want to override the C<dispatch>
method.
=back
=head1 EXAMPLES
=head2 Naive (Slightly Broken) JSON Writer
Here is similar code to the L</SYNOPSIS>, but written as a function
instead of a method,