in reply to What is Exported from modules

I don't think you can get all the imports from inside the module becuase you would not be sure what had been imported from the EXPORT_OK array. But by looking at @_module_::EXPORT and @_module_::EXPORT_OK you should be able to get a good idea of what was imported. The problem would be if you have 2 modules that export the name in the EXPORT_OK array.

Update: Added example code.

use one qw (one two three five); use two qw (one two four); print join("\n", @one::EXPORT), "\n"; sub get_exports { my $package = shift or die; my @list = (@{$package . "::EXPORT"}, @{$package . "::EXPORT_OK"} +); for my $name (@list) { my $symbol = $package . '::' . $name, " ", "\n"; if (\&{$symbol} == \&{$name}) { print "$name is imported from $package (function)\n"; } } } get_exports('one'); print "\n"; get_exports('two') print"\n"; print join(' ', one, two, three, four), "\n";
package one; use base Exporter; our @EXPORT = qw (one two); our @EXPORT_OK = qw (three four five); sub one { 1.1; } sub two { 1.2; } sub three { 1.3; } sub four { 1.4; } sub five { 1.5; }
package two; use base Exporter; our @EXPORT = qw (one two); our @EXPORT_OK = qw (three four); sub one { 2.1; } sub two { 2.2; } sub three { 2.3; } sub four { 2.4; }
-- gam3
A picture is worth a thousand words, but takes 200K.