in reply to Checking and installing a perl module

It already exists and is named cpan.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re: Checking and installing a perl module

Replies are listed 'Best First'.
Re^2: Checking and installing a perl module
by Anonymous Monk on Jun 11, 2009 at 12:06 UTC
    BEGIN { eval('use abc::fdj'); if($@) { die "You need to install ModuleName...\n" if $@; #`perl -MCPAN -e shell | install abc::def`; # `install abc::def`; } else { print "The module is installed\n"; } }
    This will check whether a module is installed....But how to install it from the script if it is not installed??
      my $module = 'My::Module'; system(cpan => $module) and die("system cpan failed: $!/$?\n");