<p>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:</p>

<pre><code>use Foo qw(:oldmode);
</code></pre>

<p>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();</p>

<p>Any ideas on how to do this?</p>

You write your own
```
sub import
```
in
```
package Foo
```
that will get called with the parameter list from
```
use Foo
```
.
An example:
```
```
package Foo;
use Exporter;

sub import {
    warn "called with paramters '@_'";

    # do the real import work
    goto &{Exporter->can('import')};
}
```
```
So in sub
```
import
```
you can search the argument list for the deprecated tag, and then throw a warning.
Update
: As Axeman points out, you should call
```
goto &{Exporter->can('import')}
```
. This form of goto replaces the current subroutine call on the stack, preserving the current arguments (if any). That's needed because Exporter's import() method will export to its caller's namespace.