That looks confusing, but so is your description of what it's supposed to do.

It looks like you're exporting subroutines into derived classes. Which you shouldn't have to do, since derived classes already inherit their methods from the base class.

Any way, if that's exactly what's in your code and this is one file then the immediate problem is you're use()ing "pm::Section" before it's defined, so pm::Section->import() is not called. Move pm::Section into it's own pm/Section.pm file.

update: the above paragraph probably isn't right, since this code would abort when trying to load pm/Section.pm, unless you've also got that file but you're defining the rest of the package here.

Also, since you're defining your own import() method, setting @EXPORT_OK & friends in pm::Section won't do a thing.

Actually, everything in pm::Section::import and pm::Section::inheir_merge looks very suspicious.


In reply to Re: Dealing with design -- inheritance + exporting gone bad :(.. by Joost
in thread Dealing with design -- inheritance + exporting gone bad :(.. by yaneurabeya

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.