in reply to How to tell if a package is loaded

I think %INC will show you everything that was pulled in via use or require.

Yes, this works for me:

perl -MFile::Find -E'print join "\n", keys %INC'

Replies are listed 'Best First'.
Re^2: How to tell if a package is loaded
by tchrist (Pilgrim) on May 02, 2011 at 23:25 UTC
    If all you want to do is play with %INC, instead of actually inspecting the symbol table properly, then you might as well use the standard core module, Module::Loaded.
      What version of Perl did Module::Loaded become core in? I'm using 5.8.8 and it is not available there.
      $ perl -MModule::Loaded Can't locate Module/Loaded.pm in @INC (@INC contains: /usr/lib64/perl5 +/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5 +.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_ +64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5 +/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/li +b/perl5/5.8.8 .). BEGIN failed--compilation aborted.
        $ corelist Module::Loaded Module::Loaded was first released with perl v5.9.4
        I'm on 5.12.2.

        See also New modules

Re^2: How to tell if a package is loaded
by educated_foo (Vicar) on May 02, 2011 at 23:38 UTC
    Kind of. Remember that a file can define more than one package, e.g.
    $ echo 'package A; package B; 1' > A.pm; perl -MA -le 'print for keys +%INC' A.pm
    If you want to know if a package is defined, rather than whether a correspondingly-named file has been loaded, the OP's approach is correct.