NAME

Import::Into::As - Wrapper around Import::Into that lets you rename subs.

DESCRIPTION

This wrapper provides a new function import::into::as which works just like import::into(), except that you can rename the subs being exported around.

This is a wrapper around Import::Into, which is an awesome tool that lets you import any module into any other module. The problem is that not all modules you are importing from have the ability to rename exports. This is not a problem if you are exporting from modules that use Sub::Exporter or Exporter::Declare, but it is a problem if you want to rename a sub exported from Exporter.

Note: If you are exporting from modules that allow you to rename the exports in their own syntax then you should use that. This module will be slower than using the exporters rename syntax when available. This module also has some limitations, see the "LIMITATIONS" section.

SYNOPSYS

use Import::Into::As;

# Export 'foo' and 'baz' from Some::Exporter into Destination::Package.
# Rename 'foo' to 'bar' in the process.
Some::Exporter->import_into_as('Destination::Package', {foo => bar}, qw/foo baz/);

METHODS

$package->import::into::as($target, \%renames, @arguments);

HOW IT WORKS

This package will localize the taget packages namespace, temporarily making it empty. This will then use Import::Into to import into the now empty namespace. Once the import is complete the new symbol table is copied. Once the original symbol table is restored the new imports will be placed into the actual namespace, but under the new names.

WHY IS IT SO COMPLICATED!?

There are some problems that have to be worked around:

LIMITATIONS

SOURCE

The source code repository for Import-Into-As can be found at http://github.com/exodist/Import-Into-As.

MAINTAINERS

AUTHORS

COPYRIGHT

Copyright 2015 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/