Oh, I was just trying to abuse the Exporter to to create a flexible function importer over packages with the ability to be able to redefine the function on a higher level

Let's say I have a package structure (where I make sure that the sub packages have a 'use parent' statement)

Parent->ChildX ->ChildY->GrandchildYX ->GrandchildYY

Inside of these packages I want have a bunch of functions with the same name:

Parent.function1 (function1 defined in Parent) ChildX.function1 (function1 imported from Parent) ChildX.function2 (function2 defined in ChildX) ChildY.function1 (function1 defined in ChildY) ChildY.function2 (function2 defined in ChildY) GrandchildYX.function1 (function1 imported from ChildY) GrandchildYX.function2 (function2 defined in GrandchildYX)
Any program that I use
use Parent qw(function1) # function 1 from Parent or use ChildX qw(function1 function2) # function1 from Parent, function2 +from ChildX or use ChildY qw(function1) # function1 from ChildY or use GrandchildYX qw(function1 function2) # function1 from ChildY, func +tion2 from GrandchildYX

The experiment/challenge was to see if I can pull this off by writing ONE import function in Parent

The code that I wrote works now I think, but it relies on the method export_to_level which I basically abuse and call static

If you want I can share the code (not now though it is late), but I have to warn you it is an ugly piece


In reply to Re^7: Exporter. Correct way to override import? by Veltro
in thread Exporter. Correct way to override import? by Veltro

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.