in reply to unimport warnings in another package

Could you give more of an example of what you are trying to do?

For instance, what the caller looks like?

I'm guessing maybe you meant to have a \ before the $ in "delete $INC..."?

The BEGIN baffles me; you can't redefine a BEGIN block, it's run as soon as it's compiled. The ${caller}:: part does absolutely nothing.

Have you tried a glob assignment?

  • Comment on Re: unimport warnings in another package

Replies are listed 'Best First'.
Re^2: unimport warnings in another package
by wazzuteke (Hermit) on Mar 21, 2007 at 13:02 UTC
    Thanks, ysth!

     > > I'm guessing maybe you meant to have a \ before the $ in "delete $INC..."?
    Oops, ya.

     > > The BEGIN baffles me; you can't redefine a BEGIN block, it's run as soon as it's compiled. The ${caller}:: part does absolutely nothing.
    That's what I thought, too. The problem really is that at import time, I'm trying to dig into functions of the caller that haven't been compiled into the symbol table at the time. In other words, the list of functions passed to the import represent functions the caller wants me to change, yet because they're called at compile-execution time, too, nothings there. The only function that's assigned at the time was BEGIN, so I gave it a try. With the re-require of the calling package, the functions get assigned to the symbol table and I can change them at my will anytime after that. (did that confuse things more?

     > > Have you tried a glob assignment?
    I did, and although that looses the warning - I hit the problem I mention earlier. Essentially, I'm trying to add some aspect-ish slicing to any calling package, where to effectively do so, I need to have the functions already defined - does that make sense? Where if I simply use a GLOB assignment, I overwrite the entire function; which isn't really my goal.

    'Caller' example
    package Caller; use strict; use warnings; # # The idea being that I want MyPackage to do something # with 'use_this_function'. Because I can't guarentee the # function will be defined at the point of import, I'm trying # to force the compilation of the module in order to get # the assignment in the symbol table so I can change it appropriately # (I use that word lightly here) # use MyPackage qw( use_this_function ); # From earlier example function dont_use_this_function { return; } function use_this_function { return; } 1;


    Thanks again for your help!

    ---------
    perl -le '$.=[qw(104 97 124 124 116 97)];*p=sub{[@{$_[0]},(45)x 2]};*d=sub{[(45)x 2,@{$_[0]}]};print map{chr}@{p(d($.))}'