in reply to Re (tilly) 1: Overriding Exporter::import
in thread Overriding Exporter::import

re beware of caller:

The normal import calls that internal function which is told how many levels back to go, so I think if used carefully it won't be any more buggy than normal :)

If I localize @EXPORT and then do a magic call-stack goto, what happens? If it transfers localization to the new routine as well, I can easily jump to the "super" form without having to muck with the internal forms.

—John

  • Comment on Re: Re (tilly) 1: Overriding Exporter::import

Replies are listed 'Best First'.
Re (tilly) 3: Overriding Exporter::import
by tilly (Archbishop) on Jul 20, 2001 at 04:06 UTC
    When you localize something and then goto, it first has to clean up your scope before removing it from the callstack and so the local is lost.

    The documented approach if you are not calling Exporter's import directly is to call export_to_level. It is buggy in at least some versions of Perl with some exports. (I think it is fine if you are just exporting functions, but if you trigger Export::Heavy...) No, I don't remember exact details, but I do have a recollection floating around that it had to do with the rewrite for Exporter/Heavy.pm. You will have to analyze the source code for yourself if you want to know more.