I'm going to have to read this more carefully later, but
I just want to clarify what I was suggesting.
- First, use BaseClass qw(Foo) would be only
one way to handle inheritance. BaseClass would use all of
the items in @ISA at that point to determine attributes (as you suggest)
but it would also be smart enough to look at that "Foo" in
its @_. In other words, your mechanism for dealing with inheritance would still be there; my suggestion
would simply provide another way to do it, one that's imho a lot simpler. But my approach wouldn't be mandatory, but
optional.
- Similarly, since any given module is going to have
only one call to define_attributes (is that correct?), it makes sense to me that it be part of the use call. If an anon. hash is not on the use BaseClass line, BaseClass would defer setting up attributes, leaving it to a define_atttributes call later in the module. There'll be more than one way to do it.
I think I'm not questioning the underlying ideas of your
approach, but rather, I'm suggesting a simplified user interface towards invoking it. Or if not simplified, then
in keeping with currently existing Perl modules that already get a lot of use and that imho have good interfaces.
Oh, and just I gotta say: I really hate the idea of having to type "SCALAR" et al. Perl already has the sigil set - why duplicate them? (Except in a 'use English' way, but again, that should be an optional WTDI.)
-- Frag.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.