No, I'm not using any module to 'reload'. Here's a more detailed outline of this problem.

Whenever a user requires some module, like this: 'require IWL::Script', my current approach was to have a subref in @INC. This subref would get called, so that it can be used to find the wanted module. Of course, I used this approach in a totally different way. So inside this subref, while the user's require is still going, I require the module myself, so that it's compiled. Unfortunately, Perl will still load the wanted module, after it exits from my subref. And since I've already loaded the same module myself, it will reload it on top of what I've loaded, thus, erasing whatever changes I've made to the symbol table.

Thanks for the second suggestion though. I'll try it and see if it works. My biggest concern is that my $old = \&IWL::Script::setScript; might create an alias, instead of a copy of the subref. So if i'd invoke the goto &$old, it might create a circular reference. Also, from what I've understood of your post, the $old copy will receive the same @_ that is visible in the scope of the wrapper, correct?

In reply to Re^2: Notification on module load, and redefinition of module methods. by /dev/urandom
in thread Notification on module load, and redefinition of module methods. by /dev/urandom

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.