Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: eval array of required modules

by farang (Hermit)
on Apr 02, 2014 at 21:15 UTC ( #1080835=note: print w/ replies, xml ) Need Help??


in reply to eval array of required modules

One solution is an eval expression with explicit $_

#!/usr/bin/env perl -l use strict; use warnings; my @required = qw( File::Basename File::Copy File::Find ); my @missing; foreach (@required) { eval "require $_"; push @missing, $_ if $@; } print "missing---> @missing" if @missing; print for sort grep m{^File/[BCF]} => keys %INC; __END__ File/Basename.pm File/Copy.pm File/Find.pm


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://1080835]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-12-27 19:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (177 votes), past polls