Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Variable as module name?

by kennethk (Monsignor)
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 cooling their heels in the Monastery: (15)
As of 2014-10-21 17:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (106 votes), past polls