How can I find out where a Perl module is installed?

后端 未结 9 821
小蘑菇
小蘑菇 2021-01-30 10:30

How do get the path of a installed Perl module by name, e.g. Time::HiRes?

I want this just because I have to run my perl script on different nodes of a SGE

9条回答
  •  逝去的感伤
    2021-01-30 10:59

    It seems like the simplest way is perldoc -l Time::HiRes.


    If that isn't available for some reason, here's a pragmatic solution:

    Step 1: Instantiate the module in your script...

    #! /usr/bin/perl -w
    use Time::HiRes();
    new Time::HiRes();
    

    Step 2: Execute the script with the Perl graphical debugger...

    export PERL5LIB=$PERL5LIB:~/perl ## tell perl where to look for "Devel"/"ptkdb.pm"
    perl -d:ptkdb (yourscript.pl)
    

    Step 3: Step in to the new call.

    The full pathname of the module will be displayed on the title-bar of the debugger window.


    Another approach that might be useful would be to search all of the folders in $PERL5LIB.

提交回复
热议问题