I have a package that I just made and I have an ‘old-mode’ that basically makes it work like it worked before: importing everything into the current namespace. One of the nice things about having this as a package is that we no longer have to do that. Anyway, what I would like to do is have it so that whenever anyone does:
use Foo qw(:oldmode);
I throw a warning that this is deprecated and that they should either import only what they need or just access functions with Foo->fun();
Any ideas on how to do this?
Well, as you specifically state that you want to alarm in the cases of
use Mod qw<:oldmode>;This works better:Thanks to Frew, for mentioning the Perl 5.10 smart match syntax. I’m learning all the ways to work Perl 5.10 into my code.
Note: the standard way to use exporter in an import sub is to either manipulate
$Exporter::ExportLevelor to callFoo->export_to_level( 1, @_ );But I like the way above. It’s quicker and, I think, simpler.