ExportInspector(3pm)

NAME
App::perlimports::ExportInspector - Inspect code for exportable symbols

VERSION
version 0.000060

SYNOPSIS
    use strict;
    use warnings;

    use App::perlimport::ExportInspector ();

    my $ei = App::perlimport::ExportInspector->new(
        module_name => 'Carp',
    );

    my $exports = $ei->explicit_exports;

DESCRIPTION
Inspect modules to see what they might export.

MOTIVATION
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.

METHODS
The following methods are available.

  implicit_exports
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 );".

  explicit_exports
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 );".

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.

  evals_ok
Returns true if either implicit or explicit exports can be built without setting $@.

  implicit_export_names_match_values
Returns true if the keys and values in "implicit_exports" match.

  explicit_export_names_match_values
Returns true if the keys and values in "explicit_exports" match.

  success_counter
Returns an integer representing the number of times we were able to execute eval statements for this package which did not pollute $@.

CAVEATS
This may not work with modules using some creative way of managing symbol exports.

AUTHOR
Olaf Alders <olaf@wundercounter.com>

COPYRIGHT AND LICENSE
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.