Mammoth constructors have absolutely nothing to do with inheritance. Inheritance is, for all practical purposes, determined when using the two-part form of bless. Nothing more, nothing less. Here's an example:

No offense, but when I mix concepts, I *mean* to mix concepts :) I don't need the CS 1 / CS 2 intro to OO class. I could teach the class (just not in Perl). Perl's OO syntax isn't pure as it should be (yet), so it takes some effort to figure out the idioms -- which has never been the case in any other language supporting OO that I've picked up.

But yes, the init hook suggested in the above replies (especially Class::Method_Maker) is what I want. Java and C++ can make use of super constructors, the init hook is exactly what I was asking about, as my named parameter implementation as the OP (sans init hook), had a few glitches that would not provide the things init() provides.

Essentially my requirements were three-fold: (A) keep the code clean (solved: MethodMaker), (B) No long mamoth constructors, so named params help (solved: hash), (C) need instructors to benefit from inheritance (solved: init hook). Success. However arriving at this was an experience!


In reply to Re: Re: Re: Re: Re: Re: Reducing Perl OO boilerplate by flyingmoose
in thread Reducing Perl OO boilerplate by flyingmoose

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.