Posts for: #Debugging

Data::Printer joy Series

This is a series of short notes about the famous Perl objects an data structures inspector. After reading this, you should have learned a couple of useful tricks that will simplify every-day’s debugging: Maximize Data::Printer strings length Demand Data::Printer to dump politely if it doesn’t want to Preload Data::Printer and avoid polluting your code with debug symbols
[Read more]

Demand Data::Printer to dump politely if it doesn’t want to

If your project got objects that use the following methods names: to_string(), as_string(), stringify(), … Data::Printer might not behave as expected… It will dump the “stringified” object (as defined in your own code, possibly $self->name or something slightly more complicated). It’s possible to disable that feature on p() call: p $fancy_object, class => { stringify => 0 }; But honestly, that’s too much typing verbosity. I prefer, to have a ~/.
[Read more]

Maximize Data::Printer strings length

The Perl data structures and objects pretty printer Data::Printer would trim strings longer than 4096 characters (this is the default value). This is something that can be parameterized in the ~/.dataprinter file: # No limit! string_max = 0 This default is sensible, though, because you usually don’t want the program output to fill with too much text. It might be necessary to change this value, only in a specific place. You can pass a false value to string_max to display the whole string fields:
[Read more]