Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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?
[stevieb]: went for a long hike in the mountains today while the weather is hovering just about freezing. I think tomorrow I'm going to huddle up and do a good read through perlguts

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2017-01-22 02:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (186 votes). Check out past polls.