App::perlimports::ExportInspector - Inspect code for exportable symbols
version 0.000052
use strict; use warnings; use App::perlimport::ExportInspector (); my $ei = App::perlimport::ExportInspector->new( module_name => 'Carp', ); my $exports = $ei->explicit_exports;
Inspect modules to see what they might export.
Since we're (maybe) importing symbols as part of this process, we've sandboxed it a little bit by not doing it in App::perlimports directly.
The following methods are available.
A HashRef with keys representing symbols which a module implicitly exports (i.e. via use Module::Name;. The values represent the import value which you would need in order to explicitly import the symbol. Often these will be the same, but there are exceptions. For example, a type library may export is_ArrayRef, but you import it via use My::Type::Library qw( ArrayRef );.
use Module::Name;
is_ArrayRef
use My::Type::Library qw( ArrayRef );
A HashRef with keys representing symbols which a module explicitly exports (i.e. via use Module::Name qw( foo bar );. The values represent the import value which you would need in order to explicitly import the symbol. Often these will be the same, but there are exceptions. For example, a type library may export is_ArrayRef, but you import it via use My::Type::Library qw( ArrayRef );.
use Module::Name qw( foo bar );
In cases where we cannot be certain about the explicit exports, you can try to fall back to the implicit exports to get an idea of what this module can export.
Returns true if either implicit or explicit exports can be built without setting $@.
$@
Returns true if the keys and values in implicit_exports match.
implicit_exports
Returns true if the keys and values in explicit_exports match.
explicit_exports
Returns an integer representing the number of times we were able to execute eval statements for this package which did not pollute $@.
This may not work with modules using some creative way of managing symbol exports.
Olaf Alders <olaf@wundercounter.com>
This software is copyright (c) 2020 by Olaf Alders.
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 App::perlimports, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::perlimports
CPAN shell
perl -MCPAN -e shell install App::perlimports
For more information on module installation, please visit the detailed CPAN module installation guide.