On Tue, 28 Dec 2004 19:30:28 +0200, Issac Goldstand
<[EMAIL PROTECTED]> wrote:
> the "use module  version" pragma only goes one way: up.
> 
>   Issac 

it's possible to trap the requested version number in your module and provide
the interface given by earlier versions when that is requested, but
it's a PITA and
an even bigger PITA if you want to support different versions getting
asked for in
different modules used within the same running system.

Here's how to do it:  within the import() function, store some behavior hints
to dynamic scalars with huge and unlikely names beneath the caller's name
space and refer to them whenver making version-specific choices.
Your module then gets bogged down with run-time polymorphism like so:

      no strict;
      return (
         # before version 7 this function returned a four-long arrayref
        ${caller().'::MyModule::VersioningSwitches::hashresults'} ?
         \%result : [EMAIL PROTECTED]/foo bar baz blarfl/}]
       )

A better, more robust solution, which few do, and which would have avoided
the current debate, is to move version numbers implying incompatibility into the
name of the module rather than the version number.  If GD 2 had been
released as GD2,
if mod_perl 2 goes onto CPAN as modperl2, if all interface-changing new releases
append numbers to the module name rather than pretending to be new releases
of old interfaces, since the updating automatons don't grok the
distinction,  instead
of trying to get them to, and if this proposed standard nomenclature convention
can be somehow backdated several years, the world would be a better place would
it not?


-- 
David L Nicol
You're striving for harmony, and, if you try to take
 too much, you'll come to grief.  -- Michael Redmond

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to