Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: eval array of required modules

by farang (Chaplain)
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 about the Monastery: (14)
As of 2015-07-29 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (268 votes), past polls