in reply to I need to install PERL MODULE first and then use it in the same SCRIPT. Is it possible
Try:
BEGIN { # This unless block just seems a little clearer than the # way you were doing it. # unless (eval { require Term::Menus }) { print "INSTALLING PERL Term::Menus MODULE\n\n"; system("/opt/hp/hadooptools/validation/smoke/cpan.sh Term::Menus +"); } } use Term::Menus;
Explanation: use happens at compile-time, before your check/install code runs. Wrapping it in a BEGIN block "lifts" that code to compile-time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: I need to install PERL MODULE first and then use it in the same SCRIPT. Is it possible
by rahulruns (Scribe) on Nov 29, 2012 at 09:06 UTC |