package Data::Printer::Profile::JSON;
use strict;
use warnings;
sub profile {
return {
show_tainted => 0,
show_unicode => 0,
show_lvalue => 0,
print_escapes => 0,
'-class' => \&_json_class_filter,
'SCALAR' => \&_json_scalar_filter,
'LVALUE' => \&_json_scalar_filter,
'CODE' => \&_json_code_filter,
'FORMAT' => \&_json_format_filter,
'GLOB' => \&_json_glob_filter,
'REF' => \&_json_ref_filter,,
'Regexp' => \&_json_regexp_filter,
####################
### JSON parsers
### Heavily inspired by nuba++'s excellent Data::Printer::Filter::JSON
#############################################
sub _parse_json_boolean {
my ($value,
web_json_true', '#ccffcc')
: ('filter_web_json_false', '#ffcccc')
);
return $ddp->maybe_colorize($value, @colors);
}
# JSON::NotString is from JSON::Parser (JSON 1.x)
filter 'JSON::No
tString' => sub { _parse_json_boolean($_[0]->{value}, $_[1]) };
# JSON::Typist
filter 'JSON::Typist::String' => sub {
my ($obj, $ddp) = @_;
require Data::Printer::Common;
my $ret = Data::
)
Sometimes you are writing a filter for data that you know will be repeated
several times, like JSON Boolean objects. To prevent Data::Printer from
showing this content as repeated, you can use the
>> to make
debugging much, much easier. Includes filters for many popular classes
from CPAN like JSON::*, URI, HTTP::*, LWP, Digest::*, DBI and DBIx::Class.
printing what really matters to developers
ze/store/restore Perl data structures, this module
will NOT help you. Try Storable, Data::Dumper, JSON, or whatever. CPAN is
full of such solutions!
Whenever you type C<use Data::Printer> or C<use DD
yes, even DBIx::Class),
L<message digests|Data::Printer::Filter::Digest> like MD5 and SHA1, and
L<JSON and Web|Data::Printer::Filter::Web> content like HTTP requests and
responses.
So much so we reco