On Tue, 2004-02-24 at 01:38, David Manura wrote: > Unfortunately, there seems to be no clean and easy way now to assert that one's > code is compatible with both 1.95 and 1.96 and to work with both versions. > However, this may do: > > use Text::Balanced 1.95_and_1.96; # ok > > The above is accidentally accepted by 1.95, and 1.96 could interpret it > specially upon overriding import().
BEGIN{ my $err1; eval 'use Text::Balanced 1.96'; $@ and do { $err1 = $@; eval 'use Text::Balanced 1.95'; $@ and die <<EOERR; tried to use Text::Balanced 1.96 and got $err1 tried to use Text::Balanced 1.95 and got $@ EOERR } } > > Would this solution hold in general when breaking module interfaces? Yep, but it's ugly as hell. In the situation where you want to have two different behaviors from the same-named module, different versions, used in different packages in the same program, a way to do that might be to choose a named package variable (such as ${caller()."::Text::Balanced::Version"} ) and assign to it within the VERSION subroutine ${caller()."::Text::Balanced::Version"} = $req_ver then when there's a choice to zag or zig, that's where you go for a hint. (I have verified that caller() is available within &VERSION.) -- david nicol this message was sent from a filtering e-mail address. your reply must include a listed "magic phrase" such as "perl"