OK. So I'm trying to take an OO approach to a problem that I have been unable to solve well in a procedural way. It is a scheduling system and I am trying to create an appointment object which will have many different sub classes.

The way I see it, the best way to approach it, since it will be a web driven system and information will come at it it many different ways and forms and in different order, I need to make it smart enough to complete itself. What I mean is that it will need to be able to determine its own state across instantiations and figure out where it has been and where it is going. So what I thought of (I have written no code yet - just in basic design stage) is having the constructor populate a hash. Lacking some very basic info (an ID from a DB sequence which would only not be there if there was an error and the type of appointment this is which is determined by what starting point the user has chosen and would also determine the objects sub-class) the constructor would fail. If it has the most basic info it attempts to shift off a whole bunch of other pieces of info. It then would look at this hash, see what it is missing, (here's the part I really need help on) determine what it needs based on what it has through some meta-data construct and then set a $state. I could then use that $appt->state as a guide for what form to throw up to the user to get the next piece of info it needs to be complete. I would then spit out the info the object already has to be put into hidden fields in the HTML and suck it all back up and do it again when the user fills out the form and submits the next piece of info.

I'm pretty sure I can do all of that. My questions are:

I thank everyone in advance for helping me sort this out. I know I should read Damian Conway's book, but I really wont have a chance until after this crunch. I have read perltoot and that rocks.

"A man's maturity -- consists in having found again the seriousness one had as a child, at play." --Nietzsche

In reply to storing meta-data for an object by jptxs

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.