To list the installed CPAN modules in Perl, you can use the following command:
perl -MCPAN -e 'my $c = CPAN::Shell->expand("Module", "/./"); print join "\n", map { $_->id } sort { $a->id cmp $b->id } $c;'
This will list all the installed CPAN modules in alphabetical order. To search for a specific module, you can use the grep
command. For example, to search for the DBI
module, use the following command:
perl -MCPAN -e 'my $c = CPAN::Shell->expand("Module", "/./"); print join "\n", map { $_->id } sort { $a->id cmp $b->id } $c;' | grep DBI