in reply to Re: Loading Modules At Run-Time With Interpolation
in thread Loading Modules At Run-Time With Interpolation

...but, having said that, your method works! Thanks!

So my question is now -- how come "require String::$varable" doesn't work but if you do that map on the array to add the String:: part first, it does?



($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print
  • Comment on Re^2: Loading Modules At Run-Time With Interpolation

Replies are listed 'Best First'.
Re^3: Loading Modules At Run-Time With Interpolation
by Tanktalus (Canon) on Aug 12, 2005 at 04:47 UTC

    You are misdiagnosing the problem. The problem isn't the require. It's where you try to use the details function. For example, both of these will work:

    my $p = 'Foo::Bar'; eval "require $p"; print $p->details->{name}; # ... and ... my $p = 'Bar'; eval "require Foo::$p"; print "Foo::$p"->details->{name};
    By merging Foo:: directly into your submodules list, we don't need to constantly recreate the full package name each time - it's already created.

      Oh dear. I feel so dumb now. Thank you. It's working perfectly now.


      ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
      =~y~b-v~a-z~s; print