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 romping around the Monastery: (4)
As of 2014-07-14 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (254 votes), past polls