What modules are distributed with Perl?

前端 未结 8 1510
误落风尘
误落风尘 2021-02-13 20:00

How do I know what modules are distributed with Perl?

My first guess is that the core modules listed here are always included, though I cannot find this stated explicitl

8条回答
  •  你的背包
    2021-02-13 20:28

    This question is a little less important now (I have root access on the eventual target machine so I'll just be installing the packages I need) but in case anyone is interested here's what I did:

    First, run this code on each of the target systems:

    foreach my $dir (@INC) {
        print "Directory: $dir\n";
        if (-d "$dir") {
            my @modules = `find $dir/ -name "*.pm"`;
            foreach my $m (@modules) {
                my $label = $m;
                $label =~ s|\n$||;
                $label =~ s|//+|/|g;
                $label =~ s|^$dir/||;
                print "$label\n";
            }
        }
    }
    

    Note you need a *nix system with a find command. Dump the output into three files, sorted. Then use commands like this (from memory):

    grep -F -x -f list-1.txt list2.txt > list-12.txt
    grep -F -x -f list-12.txt list3.txt > list-123.txt
    

    Now list-123.txt should have the list of shared modules, more or less.

    For what it's worth, all three systems shared a few extra modules, notably the XML::Parser modules.

提交回复
热议问题