Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: eval array of required modules

by BrowserUk (Pope)
on Apr 02, 2014 at 09:26 UTC ( #1080714=note: print w/ replies, xml ) Need Help??


in reply to eval array of required modules

Try it this way:

#! perl -slw use strict; use Data::Dump qw[ pp ]; my @required = qw( File::Basename File::Copy File::Find ); pp \%INC; my @missing; foreach (@required) { s[::][/]g; s[$][.pm]; eval { require }; push @missing, $_ if $@; } print for @missing; pp \%INC; __END__ C:\test>junk39 { "Data/Dump.pm" => "c:/perl64/lib/Data/Dump.pm +", "Exporter.pm" => "c:/perl64/lib/Exporter.pm" +, "List/Util.pm" => "c:/perl64/site/lib/List/Ut +il.pm", "Scalar/Util.pm" => "c:/perl64/site/lib/Scalar/ +Util.pm", "XSLoader.pm" => "c:/perl64/lib/XSLoader.pm" +, "c:/perl64/site/lib/sitecustomize.pl" => "c:/perl64/site/lib/sitecus +tomize.pl", "overload.pm" => "c:/perl64/lib/overload.pm" +, "strict.pm" => "c:/perl64/lib/strict.pm", "subs.pm" => "c:/perl64/lib/subs.pm", "vars.pm" => "c:/perl64/lib/vars.pm", "warnings.pm" => "c:/perl64/lib/warnings.pm" +, "warnings/register.pm" => "c:/perl64/lib/warnings/reg +ister.pm", } { "Config.pm" => "c:/perl64/lib/Config.pm", "Cwd.pm" => "c:/perl64/site/lib/Cwd.pm" +, "Data/Dump.pm" => "c:/perl64/lib/Data/Dump.pm +", "Exporter.pm" => "c:/perl64/lib/Exporter.pm" +, "File/Basename.pm" => "c:/perl64/lib/File/Basenam +e.pm", "File/Copy.pm" => "c:/perl64/lib/File/Copy.pm +", "File/Find.pm" => "c:/perl64/lib/File/Find.pm +", "File/Spec.pm" => "c:/perl64/site/lib/File/Sp +ec.pm", "File/Spec/Unix.pm" => "c:/perl64/site/lib/File/Sp +ec/Unix.pm", "File/Spec/Win32.pm" => "c:/perl64/site/lib/File/Sp +ec/Win32.pm", "List/Util.pm" => "c:/perl64/site/lib/List/Ut +il.pm", "Scalar/Util.pm" => "c:/perl64/site/lib/Scalar/ +Util.pm", "XSLoader.pm" => "c:/perl64/lib/XSLoader.pm" +, "c:/perl64/site/lib/sitecustomize.pl" => "c:/perl64/site/lib/sitecus +tomize.pl", "overload.pm" => "c:/perl64/lib/overload.pm" +, "re.pm" => "c:/perl64/lib/re.pm", "strict.pm" => "c:/perl64/lib/strict.pm", "subs.pm" => "c:/perl64/lib/subs.pm", "vars.pm" => "c:/perl64/lib/vars.pm", "warnings.pm" => "c:/perl64/lib/warnings.pm" +, "warnings/register.pm" => "c:/perl64/lib/warnings/reg +ister.pm", }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: eval array of required modules
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-12-25 03:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls