DOKK / manpages / debian 12 / perlimports / App::perlimports::ExportInspector.3pm.en
ExportInspector(3pm) User Contributed Perl Documentation ExportInspector(3pm)

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

version 0.000050

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

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.

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

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

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

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.

2023-02-15 perl v5.36.0