in reply to get package x to import package y if you use package z

First tip. Get in the habit of using @EXPORT_OK rather than @EXPORT. You can thank me when you are debugging and are trying to find where scotch comes from.

The usual way to solve this problem is to import and re-export. But that is what you don't want to do. So what else can we do?

Well the underhanded way to do what you want is:

use CGI::Application::Plugin::Session; sub import { my $package = "CGI::Application::Plugin::Session"; $_[0] = $package; goto $package->can("import"); }
But that is kind of magic. And won't work if you want to do the re-export trick more than once. After peeking at Exporter carefully, you should be able to do the same thing as the above with the following:
use CGI::Application::Plugin::Session; sub import { shift; # Throw away my class my $call_package = caller(); my $export_package = "CGI::Application::Plugin::Session"; Exporter::export($export_package, $call_package, @_); }
And the advantage of this is that if you wanted to do this trick for multiple packages you could look in the @EXPORT and @EXPORT_OK lists for each, and call export on each while passing through the right arguments.

Update: GrandFather noted a missing ')'. Fixed.