Hi Brad :-). The reason you can't see into the objects innards is indeed its inheritance from Class::Std. Take a look at this bit from the introduction of the Class::Std POD:

Most programmers who use Perl's object-oriented features construct their objects by blessing a hash. But, in doing so, they undermine the robustness of the OO approach. Hash-based objects are unencapsulated: their entries are open for the world to access and modify.

So this is a feature of this particular way of doing objects. Not one I personally particularly care for (which is one of the reasons I said the usage of Class::Std-based modules is not necessarily recommended in my email), but in this case seems to be a resounding success if you are in the habit of peeking into the object in order to figure out how best to use it. The innards of an object should never matter to you as a module user, you should always access them via the published interface, i.e. the methods documented in the module POD. "Normal" (hash-based) Perl modules just trust you to do that and don't prevent you from bypassing the interface. Class::Std and its ilk protect you from yourself in that they only allow access via the interface and don't allow you to peek and prod.

So the answer to your question on how to use a CPAN module: read the module documentation and use the module according to that. If something doesn't work, then break out Data::Dumper and maybe try to figure out why, or send a bug report to the module author that they either fix their module or the docs.


All dogma is stupid.

In reply to Re: Understanding how to *use* a CPAN module by tirwhan
in thread Understanding how to *use* a CPAN module by bradcathey

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.