Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 contemplating the Monastery: (6)
As of 2014-10-21 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (95 votes), past polls