NAME
Importer::Zim - Import functions à la Invader Zim
VERSION
version 0.9.1
SYNOPSIS
use Importer::Zim 'Scalar::Util' => 'blessed';
use Importer::Zim 'Scalar::Util' => 'blessed' => { -as => 'typeof' };
use Importer::Zim 'Mango::BSON' => ':bson';
use Importer::Zim 'Foo' => { -version => '3.0' } => 'foo';
use Importer::Zim 'SpaceTime::Machine' => [qw(robot rubber_pig)];
DESCRIPTION
"Because, when you create a giant monster of doom,
no matter how cute, you have to... you have to... I don't know."
– Zim
This pragma imports subroutines from other modules in a clean way. "Clean imports" here mean that the import symbols are available only at some scope.
Importer::Zim relies on pluggable backends which give a precise meaning to "available at some scope". For example, Importer::Zim::Lexical creates lexical subs that go away as soon the lexical scope ends.
By default, Importer::Zim looks at package variables @EXPORT
, @EXPORT_OK
and %EXPORT_TAGS
to decide what are exportable subroutines. It tries its best to implement a behavior akin to Exporter without the corresponding namespace pollution.
BACKENDS
Importer::Zim will try the following backends in order until one succeeds to load.
Importer::Zim::Lexical - symbols are imported as lexical subroutines
Importer::Zim::EndOfScope - symbols are imported to caller namespace while surrounding scope is compiled
Importer::Zim::Unit - symbols are imported to caller namespace while current unit is compiled
Read also "WHICH BACKEND?" in Importer::Zim::Cookbook.
METHODS
import
Importer::Zim->import($class => @imports);
Importer::Zim->import($class => \%opts => @imports);
FUNCTIONS
export_to
Importer::Zim::export_to($target, %imports);
Importer::Zim::export_to($target, \%imports);
DEBUGGING
You can set the IMPORTER_ZIM_DEBUG
environment variable for get some diagnostics information printed to STDERR
.
IMPORTER_ZIM_DEBUG=1
SEE ALSO
Importer and Lexical::Importer
AUTHOR
Adriano Ferreira <ferreira@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Adriano Ferreira.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.