in reply to Re: Roger the Phone Guy
in thread Roger the Phone Guy

apt-get install libexpect-perl libterm-vt102-perl libdata-dumper
above are installed.

Is there any way to check if module is loaded and installed on perl ?

Replies are listed 'Best First'.
Re^3: Roger the Phone Guy
by talexb (Chancellor) on Aug 02, 2018 at 04:50 UTC

    I usually do perldoc -l Data::Dumper at the command line. Just tried it on one of my systems, and I got

    /usr/lib/x86_64-linux-gnu/perl/5.26/Data/Dumper.pm
    in response. To find out the version, I grep for version in that file ..
    $ grep -i '^version' /usr/lib/x86_64-linux-gnu/perl/5.26/Data/Dumper.p +m Version 2.167 (January 4 2017) $
    Conversely, if the perldoc approach doesn't turn anything up, either the module isn't installed -- or it doesn't have POD. Then you could try using it in the debugger:
    $ perl -MData::Dumper -de 1 Loading DB routines from perl5db.pl version 1.51 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): 1 DB<1>
    If that loads OK, then the module does exist. If Perl can't find the module, it'll complain.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re^3: Roger the Phone Guy
by hippo (Archbishop) on Aug 02, 2018 at 10:41 UTC
Re^3: Roger the Phone Guy
by Anonymous Monk on Aug 02, 2018 at 06:15 UTC
    > Is there any way to check if module is loaded and installed on perl ?

    There are many ways:

    perl -MModule::Metadata -le'$i=Module::Metadata->new_from_module($ARGV +[0]);print $i->{filename}' Data::Dumper
    perl -MExtUtils::Installed -le'$i=ExtUtils::Installed->new;print grep +/$ARGV[0]/, $i->files("Perl")' Dumper
    perl -MFile::Find -le'find(sub{print $File::Find::name if /$ARGV[0]/}, +$_) for @INC' Dumper
Re^3: Roger the Phone Guy
by bliako (Abbot) on Aug 02, 2018 at 12:16 UTC

    I use whichpm. It's a module on its own and needs to be installed.