The Namespaces for your classes have not been declared, at the time you are attempting to use them.
Wrong. They are. The namespace here are introduced with package and are hence found at compile time.
You should also add a "1;" at the end of each class (Although your code works without that).
And wrong again. The true value is only needed for compilation blocks that are required or used.
add an INIT before each block declaring the class like this:
That will "work" (well, sort of, it may not work if the code is used or required), but for the wrong reasons. Note also that you're using INIT to get the @ISA assignment done at compile time - but now that you've switched to using use base in your update, the assignment to @ISA is done at compile time, making the INIT pointless. In fact, the only thing now left in the INIT blocks to be executed are the useless 1; statements. So you've created a pointless block, for the sole purpose of executing a useless statement. Way to go!

With so many bogus statements, I hope you don't mind getting downvoted (but overall your note still has a postive rating. Another proof that XP means utterly nothing, and certainly cannot be used to determine good posts from utter crap. Or may it just means Perlmonks is mostly visited by people not knowing Perl very well).

The key in the OPs problem is the assignement to @ISA. @ISA is used to determine the inheritance tree, but assignment to @ISA is done at runtime. And the appropriate @ISA hasn't been set at the time new is called.


In reply to Re^2: basic inheritance question by JavaFan
in thread basic inheritance question by jason_s

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.