Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: How do you do multi-version modules?

by kcott (Chancellor)
on Oct 13, 2012 at 23:30 UTC ( #998885=note: print w/replies, xml ) Need Help??

in reply to How do you do multi-version modules?

G'day Linda,

"... when a user says: "use module 1.0.0", and I'm working in module "2.0.0"? My 2.0.0 module would never get called as far as I can"

use Module VERSION specifies a minimum version. If the user has v2.0.0 installed and their code has use Module 1.0.0;, this will work fine.

"What I would want to do is have my 2.0.0 module detect if it was called by something prior to 2.0, and apply the old interface semantics for compatibility."

You can add a VERSION method to your class to achieve this.

This is described in use. This doco may be a little confusing: you want the use Module VERSION info (near the middle of the page); not the use VERSION info (near the top of the page).

-- Ken

Replies are listed 'Best First'.
Re^2: How do you do multi-version modules?
by perl-diddler (Hermit) on Oct 14, 2012 at 01:15 UTC
    Thanks for the tip...I think in all the other stuff about use, I missed that section... Will have to go study it again...(so many places are like that -- especially when functions get updated...)... Yup, that sounds about perfect... didn't realize version was an overridable universal method...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998885]
[ambrus]: what kind of restaurant?
[LanX]: with different specialized employees in different rooms
[LanX]: communication overhead calls for sensible management
[ambrus]: "different specialized employees in different rooms" => so, there's a cleaner guy who cleans up the vomit from the bathroom every morning?
[erix]: makes me think of MMM too (mythical man month): "adding more people to a project makes it slower"

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2017-09-22 13:45 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (264 votes). Check out past polls.