Importer::Zim - Import functions à la Invader Zim
version 0.9.0
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)];
"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.
@EXPORT
@EXPORT_OK
%EXPORT_TAGS
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.
Importer::Zim->import($class => @imports); Importer::Zim->import($class => \%opts => @imports);
Importer::Zim::export_to($target, %imports); Importer::Zim::export_to($target, \%imports);
You can set the IMPORTER_ZIM_DEBUG environment variable for get some diagnostics information printed to STDERR.
IMPORTER_ZIM_DEBUG
STDERR
IMPORTER_ZIM_DEBUG=1
zim
Importer::Zim::Cookbook
Importer and Lexical::Importer
lexically
Adriano Ferreira <ferreira@cpan.org>
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.
To install Importer::Zim, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Importer::Zim
CPAN shell
perl -MCPAN -e shell install Importer::Zim
For more information on module installation, please visit the detailed CPAN module installation guide.