Deprecated modules warn when they are used

chris fedde asks How do we know when a CORE module is deprecated?. I don't know what was there originally, but it set off a lot of fingerpointing and posturing, and nobody answered the Perl question for the rest of the universe that finds it that post through Google!

perlpolicy says

As of Perl 5.12, deprecated features and modules warn the user as they're used.

There's the deprecate module which provides this warning. A module is deprecated for at least one cycle before it's actually removed. That doesn't help much if you skip over several perl versions.

Module::CoreList tracks deprecated modules too.

And, as one commenter, mentioned, the fallback is for people to read the perldelta pages to find the changes between the version they are using and the version they want to upgrade too.

The information is out there, and as programmers, we have everything we need to play with it however we like. :)


I think that there is an important distinction to make here. On the one hand Modules themselves can be discouraged, deprecated and removed. On the other a module's inclusion in the CORE uses the same words but has no relation to the utility state of the module itself. As with much of perl, context is important.

I unsuccessfully tried to use this module to mark my non-core module as deprecated. Yes, this module was created for core-modules only, but why? I have found no simple and obvious way to mark arbitrary modules as deprecated, so far. Stumbling upon this module, I expected something like this:

package SomeDeprecatedModule;
use deprecated (instead => 'BetterModule');
warn __PACKAGE__, " is deprecated. Please use Better::Module instead.\n"
    unless state $have_warned++;

Leave a comment

About brian d foy

user-pic I'm the author of Mastering Perl, and the co-author of Learning Perl (6th Edition), Intermediate Perl, Programming Perl (4th Edition) and Effective Perl Programming (2nd Edition).