Programmatically retrieve a list of all included Perl packages

Does anyone know a way to iterate at runtime Perl through all the packages that were actually included (i.e. use'd or require' d) in a Perl program? I have found many answers on how to find all installed packages, but this is not what interests me. I specifically want to get a list of only those packages that are really included in the program. Is this even possible?

I am using Perl 5.26.0, by the way.

+4
source share
1 answer

The hash %INCcontains all downloaded packages, see perlvar .

print "$_\n" for keys %INC;
+8
source

Source: https://habr.com/ru/post/1695272/


All Articles