Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

sundialsvc4, first thank you for the respect, courtesy, and politeness. You did not have to be any of those things, so I appreciate it. Perl is my first and only programming language, and I am learning programming concepts as I go. I had perltoot up in my browser as I was trying to write that object above, however the example in "Constructors and Instance Methods" did not show how a predefined data source, in my case an HoH, could be connected to an object. Even after reading perltoot, I made my best guess on how to reference a hash in a hash in an object even though my guess was wrong. Had perltoot started with package People; instead of package Person;, I may have gotten the hang of objects sooner.

perltoot starts with a table for one person we know nothing about (in this case Jason), instead of starting with a table for several people for whom we have already gathered data (not only Jason, but his peers Norbert, Rhys, and Phineas too). Had perltoot started with the following and created package people; first, it would have been more enlightening to me.

my $records = [ { name => "Jason", age => 23, peers => [ "Norbert", "Rhys", "Phineas"], }, { name => "Norbert", age => 24, peers => [ "Jason", "Phineas", "Michael"], }, { name => "Rhys", age => 22, peers => [ "Norbert", "Jason", "Robert"], }, { name => "Phineas", age => 23, peers => [ "Norbert", "Jason", "Alexandra"], }, ];

I could possibly take an example object which had an A(ref)oH and converted it to an HoH in my objects. I was having a hard time with perltoot starting in what I consider the end.

Have a cookie and a very nice day!
Lady Aleena

In reply to Re^2: Why won't a hash in a hash work as a hash reference to create an object? by Lady_Aleena
in thread Why won't a hash in a hash work as a hash reference to create an object? by Lady_Aleena

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-03-29 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found