Data::P...er::Web(3)

✨ NAME ✨

Bestie, welcome to the cute little manual for Data::Printer::Filter::Web β€” yep, that's the Data::P...er::Web(3) page, from the User Contributed Perl Documentation. Its whole vibe is pretty-printing of HTTP/JSON/LWP/Plack/Dancer/Catalyst/Mojo... πŸ’…


✨ SYNOPSIS ✨

Drop this in your .dataprinter file, bestie:

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 🌸

Okay so: this is a filter plugin for Data::Printer. It filters through several web-related objects and displays their content in a (hopefully!) more useful way than a regular dump. Periodt. πŸ’–


🌈 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. Slay. ✨

πŸͺ 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. Lowkey important. 🫢

πŸ“¬ 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. Iconic behavior. πŸ‘‘

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.

Heads up, bestie: filter_web.show_redirect starts at 1, so that redirect chain is showing by default unless you change it. πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

Data::Printer β€” that's it, that's the list. Go give it a read, bestie. πŸ’œ


Okay bye! This was the Data::P...er::Web(3) page, coming at you from perl v5.42.0, dated 2024-01-23. Mwah! πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from