Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Install missing modules with Module::Extract::Install's cpanm-missing/cpanm-missing-deep

by glenn (Scribe)
on Aug 18, 2014 at 14:59 UTC ( #1097859=note: print w/replies, xml ) Need Help??


in reply to Install missing modules with Module::Extract::Install's cpanm-missing/cpanm-missing-deep

Since my scripts get put on a lot of systems and people have varying degrees of ability and explaining takes time I include this in the head of each of my scripts.

BEGIN { my @installmodules = ( "DBI", "XML::Simple", "Tk", "Data::Dumper", "Data::Printer" ); my @removemodules = ( "Socket6", "IO::Socket::INET6" ); foreach my $module (@installmodules) { eval "use $module"; if ($@) { $module =~ s/::/-/g; print "Package $module is not installed\n"; if ($module eq "Net-LDAP") { $module = "perl-ldap"; } my $result = system("ppm install $module"); if ($result != 0) { die "Could not install all libraries/modules required. + Failed to install [$module].\n"; } } } foreach my $module (@removemodules) { eval "use $module"; unless ($@) { $module =~ s/::/-/g; print "Problem package $module is installed\n"; my $result = system("ppm remove --force $module"); if ($result != 0) { die "Could not remove all libraries/modules required. +Failed to remove [$module].\n"; } } } }
  • Comment on Re: Install missing modules with Module::Extract::Install's cpanm-missing/cpanm-missing-deep
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1097859]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-10-05 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (24 votes). Check out past polls.

    Notices?