http://www.perlmonks.org?node_id=998885


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 tell...no?"

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