Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 contemplating the Monastery: (7)
As of 2014-07-29 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls