Breaking users of old versions of a module
Suppose that for some reason you really, really need to introduce a silent, backward-incompatible change for a module. For example, in 0.03 and earlier foo() accepts ($a, $b) as arguments but you need to change it to ($b, $a). After releasing v0.04, you probably also want to break code that says any of the following:
use MyModule; # no version specified use MyModule 0.01; use MyModule 0.02; use MyModule 0.03;
by, e.g., croaking with a message like "Order of arguments of foo() changed in 0.04, please use older version or update your code. Program aborted."
Reading up on "perldoc -f use" and browsing on CPAN, I found version::Limit which does almost that. You can put something like this in MyModule.pm:
use version::Limit; version::Limit::Scope( "[0.0,0.4)" => "Order of arguments of foo() changed in 0.04", );
version::Limit works by installing a VERSION() method into your module's package. This method is called by Perl when user is use-ing some module with a version requirement. But unfortunately, if user does not specify explicit version requirement, VERSION() will not be called.
If the change is backward-incompatible enough, you probably want to break use MyModule; (loading a module without version requirement) too.
One of the ways to do this is to also install the version checking routine into import(). But perhaps there are better ways?