use warnings; use strict; use Data::Dumper; use Module::Installed qw(module_installed includes_installed); my $module = 'PPI'; my $file = '/home/spek/repos/module-installed/t/data/test.pl'; my $statement = module_installed($module) ? "is installed" : "isn't installed"; print "$module $statement\n\n"; print "Checking includes in file $file\n\n"; my $includes = includes_installed($file); print Dumper $includes; #### PPI is installed Checking includes in file /home/spek/repos/module-installed/t/data/test.pl $VAR1 = { 'Carp' => 1, 'Not::Installed' => 0, 'strict' => 1, 'warnings' => 1, 'Load::Fail' => 0, 'Exporter' => 1, 'Data::Dumper' => 1 };