in reply to Re: Checking and installing a perl module
in thread Checking and installing a perl module

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??

Replies are listed 'Best First'.
Re^3: Checking and installing a perl module
by ikegami (Patriarch) on Jun 11, 2009 at 13:36 UTC
    my $module = 'My::Module'; system(cpan => $module) and die("system cpan failed: $!/$?\n");