Scroll to navigation

Data::Printer::Filter::Web(3pm) User Contributed Perl Documentation Data::Printer::Filter::Web(3pm)

NAME

Data::Printer::Filter::Web - pretty-printing of HTTP/JSON/LWP/Plack/Dancer/Catalyst/Mojo...

SYNOPSIS

In your ".dataprinter" file:

    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

DESCRIPTION

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.

PARSED MODULES

JSON

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:

"JSON::PP", "JSON::XS", "JSON", "JSON::MaybeXS", "Cpanel::JSON::XS", "JSON", "JSON::SL", "Pegex::JSON", "JSON::Tiny", "JSON::Any", "JSON::DWIW" and "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.

COOKIES

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.

HTTP REQUEST/RESPONSE

"HTTP::Request" and "HTTP::Response" objects are filtered to display headers and content. These are returned by LWP::UserAgent, WWW::Mechanize and many others.

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.

SEE ALSO

Data::Printer

2023-10-21 perl v5.36.0