On Wed, 2004-03-03 at 23:24, David Manura wrote:
> 
> The approach I currently use is what you do not recommend.  How does the above 
> T::B 1.96 source code break Pollute?

    $caller = caller() unless caller() =~ /^Exporter(?:::Heavy)?$/;
    $request_versions{$caller} = $req_ver;

Pollute works by re-exporting imported symbols. At use/VERSION time,
caller would be "Pollute" rather than the package where the methods are
going to get called from.  I don't know how widely used Pollute is,
but the other re-exporting modules may take similar approaches.  The
hash lookup into %request_versions shouldn't be any faster than
the hash lookup into the dynamic variables.  We could set flags for
interface-number-based decisions at VERSION time


    $req_ver >= 1.96 and return 1;
    ${caller()."::__Text_Balanced_Old_Interface_Flag"} = 1;


Then later, instead of referring to $request_versions{$caller} and
checking that against numbers, we can check

        exists("${caller}::__Text_Balanced_Old_Interface_Flag"})


This way, if Text::Balanced was included in a Pollute include file


        use Pollute;
        use Text::Balanced 1.93;
        use Chemical::Imbalance;
        ...
        Pollute;
        1;

the flag variable $__Text_Balanced_Old_Interface_Flag will get rexported.



Reply via email to