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:

use Data::Dumper; ... my $ua = LWP::UserAgent->new; print Dumper $ua; ... my $res = $ua->get(...); print Dumper $res; ...
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
    $ua->show_progress
the same thing as
    $$ua{show_progress}
?

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).

c:\@Work\Perl>perl -wMstrict -le "{ package Foo; use Data::Dump qw(pp); ;; sub new { my $class = shift; return bless { show_progress => 'not so fast', @_, } => $class; } sub show_progress { my $self = shift; print 'Real Thing: ', pp $self; } } ;; my $object_reference = Foo->new(foo => 'bar', hi => 'lo'); ;; $object_reference->show_progress; print 'A: ', $$object_reference {show_progress}; print 'B: ', $object_reference->{show_progress}; " Real Thing: bless({ foo => "bar", hi => "lo", show_progress => "not so + fast" }, "Foo") A: not so fast B: not so fast
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:  <%-{-{-{-<


In reply to Re^3: data dumper question by AnomalousMonk
in thread data dumper question by Todd Chester

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.