logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Author

       Olaf Alders <olaf@wundercounter.com>

Caveats

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

Description

       Inspect modules to see what they might export.

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 $@.

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.

Name

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

Synopsis

           use strict;
           use warnings;

           use App::perlimport::ExportInspector ();

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

           my $exports = $ei->explicit_exports;

Version

       version 0.000057

See Also