Data::Printer::Filter::Web - pretty-printing of HTTP/JSON/LWP/Plack/Dancer/Catalyst/Mojo...
In your .dataprinter file:
.dataprinter
filters = Web
You may also customize the look and feel with the following options (defaults shown):
filter_web.show_class_name = 0 filter_web.expand_headers = 1 filter_web.show_redirect = 1 filter_web.show_request_in_response = 0 # you can even customize your themes: colors.filter_web_json_true = #ccffcc colors.filter_web_json_false = #ffcccc colors.filter_web_cookie = #0b3e21 colors.filter_web_method = #fefe33 colors.filter_web_uri = $fefe88 colors.filter_web_response_success = #fefe33 colors.filter_web_response_info = #fefe33 colors.filter_web_response_redirect = #fefe33 colors.filter_web_response_error = #fefe33
This is a filter plugin for Data::Printer. It filters through several web-related objects and display their content in a (hopefully!) more userful way than a regular dump.
Because Perl has no true or false tokens, many JSON parsers implement boolean objects to represent those. With this filter, you'll get "true" and "false" (which is what probably you want to see) instead of an object dump on those booleans. This module filters through the following modules:
true
false
JSON::PP, JSON::XS, JSON, JSON::MaybeXS, Cpanel::JSON::XS, JSON::Parser, JSON::SL, Pegex::JSON, JSON::Tiny, JSON::Any, JSON::DWIW and Mojo::JSON.
JSON::PP
JSON::XS
JSON
JSON::MaybeXS
Cpanel::JSON::XS
JSON::Parser
JSON::SL
Pegex::JSON
JSON::Tiny
JSON::Any
JSON::DWIW
Mojo::JSON
Also, if you use JSON::Typist to parse your JSON strings, a Data::Printer dump using this filter will always properly print numbers as numbers and strings as strings.
JSON::Typist
This filter is able to handle cookies from Dancer/Dancer2 and Mojolicious frameworks. Other frameworks like Catalyst rely on HTTP::CookieJar and HTTP::Cookies, which simply store them in a hash, not an object.
Dancer
Dancer2
Mojolicious
Catalyst
HTTP::CookieJar
HTTP::Cookies
HTTP::Request and HTTP::Response objects are filtered to display headers and content.
HTTP::Request
HTTP::Response
If the response comes from chained redirects (that the source HTTP::Response object knows about), this filter will show you the entire redirect chain above the actual object. You may disable this by changing the filter_web.show_redirect option.
filter_web.show_redirect
Data::Printer
To install Data::Printer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Printer
CPAN shell
perl -MCPAN -e shell install Data::Printer
For more information on module installation, please visit the detailed CPAN module installation guide.