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

Another approach would be to say, "I want to import only baz from v2.0. Everything else comes from 1.0" I'd do this with:
use Module v1.0 qw/foo bar/; use Module v1.2 only qw/baz/;
Of course, you could use -only or something similar. Then this would follow your "use the last" rule allowing:
use Module v1.0 qw/foo bar/; use Module v1.2 only qw/baz/; use Module v1.7 gw/bam/;
to mean "use bam from 1.7, baz from 1.2, foo and bar from 1.0. If the user asks for some thing explicitly try 1.7 first then 1.0."

Just my USD(1.0/50), --traveler

Replies are listed 'Best First'.
Re: Re: How should this work ? (design of Exporter::VA)
by John M. Dlugosz (Monsignor) on Dec 18, 2002 at 21:36 UTC
    I like that. I was thinking of a "suppliment" keyword or somesuch that would be for subsequent invokations, but I like the semantics of "only". It would suppress setting up the direct-call autoload hooks, or prevent conflict if used subsequently.

    The import pragma switches are double-dashed. If you don't define them, they are inherited from Exporter::VA to control the export process itself. So I'd say use Module v1.2 qw/ --only baz /;.

    Looking at tye's reply, what would you name a switch that does the opposite, that is, enables the AUTOLOAD hook to allow direct calls to the module to be versioned?

    —John

      what would you name a switch that does the opposite, that is, enables the AUTOLOAD hook to allow direct calls to the module to be versioned?

      I had a bit of trouble parsing this. Do you mean setting a default version for calls to functions that aren't explicitly exported? If that's what you mean, I wouldn't do it. I look at the versions in reverse order of being used.

      If I'm not understanding, could you give an example?

      --traveler