in reply to Re: data dumper question
in thread data dumper question
> Regarding Data::Dumper , what's wrong with the examples in the docs?
Probably nothing. I just don't understand it. (I did look at it before posting this.) Would you mind weaving it into my code so I can see for myself?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: data dumper question
by AnomalousMonk (Archbishop) on Sep 13, 2016 at 02:31 UTC | |
Would you mind weaving it into my code so I can see for myself? (Note: The following provides answers already given in essence by LanX, but it at least also provides an example of sorts and so may be helpful.) ... how would I use [data dumper] to see the data and the structure of $ua and $res? Untested: Please see Data::Dumper. (Note: Be prepared for a lot of data to be dumped from some object references!) Also a point of confusion: is It is not. The expression $ua->show_progress invokes (without any arguments) the method show_progress() in the class (or a superclass) of which $ua is an object reference. The expression $$ua{show_progress} attempts to access the value of the 'show_progress' key in the anonymous hash to which $ua is presumed to be a reference; it is an error if $ua is not a hash reference. This expression is the same as the form $ua->{show_progress} which is preferred (properly, IMHO). I'm using Data::Dump in this example instead of Data::Dumper because I like its output formatting better; the latter is core, the former is not. Give a man a fish: <%-{-{-{-< | [reply] [d/l] [select] |
|
Re^3: data dumper question
by Marshall (Canon) on Sep 13, 2016 at 04:30 UTC | |
I see from Need help with loop syntax errors, that you like to experiment. I suggest that you do more of the same with Data::Dumper to empirically see what it does with various data structures. In general you give Dumper a reference to any arbitrary structure and it figures out how to display it. Here is some "play" code to get you started: There is more than one module that can dump data, but Data::Dumper is "core" meaning that it is included in all Perl distributions and you can just assume that it is there without having to install anything. Have fun experimenting. | [reply] [d/l] |