Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Variable as module name?

by kennethk (Abbot)
on Feb 01, 2013 at 23:03 UTC ( #1016621=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $module_name = 'Foo';
    eval "use $module_name;1;" or die "Couldn't use $module_name: $@";
    
  2. or download this
    #!/usr/bin/perl
    use strict;
    use warnings;
    ...
    require $module_path;
    
    print Dumper $module->new;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2016-10-01 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (575 votes). Check out past polls.