One of my favorite scammers with Perl debugging code (on the debbugger command line, perl -d) is the fact that erroneous printing (via the command x) ensures that the contents of the huge data structure will delay your terminal forever and half, while 100 page pages print . Especially if this happens through a slow network.
Thus, I would like to be able to limit the amount of data that xprints.
I see two approaches - I would like to try if someone knows how to do this.
Limit the amount of data to any single command in the debugger prints.
Even better, somehow replace the built-in command xwith a custom Perl method (which will calculate the "size" of the data structure and refuse to print its contents without confirmation).
I specifically ask: “How to replace xwith custom code” - creating “Good enough” is too big a data structure. "The Perl method is something that I can do on my own without much effort, although I see enough traps that prevent the" ideal "due to the fact that this is pretty unpleasant work. Heck, just doing Data :: Dumper-> Dump and taking line length can do the trick :)
Please note that I know very well how to manually avoid the problem by recursively examining the layers of the data structure (for example, print ref, print the number of keys / elements of an array, etc.) ... all I want to be able to avoid thoughtlessly entering text x $huge_pile_of_datawithout thinking - or stumbling over an error filling a huge pile of data into what should be a scalar.
source
share