in reply to How should this work ? (design of Exporter::VA)

Perhaps the most robust approach would be to make it illegal by default and provide a method to make it explicit which one you want to be default. But I'd lean toward using    use Module v1.0 (); to set the explicit default. And if I did that then I'd probably opt for the simplified implementation and just use the last version number specified.

And won't you run into modules that need to know the module version number of the desired behavior when some of their subroutines are called? I doubt such modules are likely to be fancier than the above.

        - tye

Replies are listed 'Best First'.
Re: (tye)Re: How should this work ? (design of Exporter::VA)
by John M. Dlugosz (Monsignor) on Dec 18, 2002 at 21:44 UTC
    I like the idea of not enabling the AUTOLOAD trapping to generate run-time version check redirection unless explicitly enabled.

    But, using () on use disables any call to import, so that's a complicating factor to using this syntax.

    Your last point: If I understand, suppose Module::Foo is not itself versioned via redirecting it to Foo_old or Foo_new. It's simply named Foo. It might contain an explicitly-coded run-time check to see if the client wants new behavior or old behavior. It can find out by calling a method on the blessed %EXPORT definition. If Foo calls _helper which then needs to know, it does it the same way.

    Ah, but that behavior is coded into the function directly and won't care if I call the imported link or the direct function, since they both work the same. So a switch to enable/disable the versioning is not going to mean anything to it. But there is no confusion, since the user asked for a specific version of Foo, regardless of what else he asked for. (It implies that I need per-function memory on this, rather than a single setting)

    —John