Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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 ( [id://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"; } } } }

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?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-19 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found