in reply to Loading a module at runtime

Read the docs for eval. With eval { BLOCK } the code in BLOCK is parsed at 'compile' time. With eval $string the code in $string can not be parsed until 'runtime'. use is executed before runtime. Perhaps your evals worked when the contents were strings. Perhaps you want to use require (update: I see you have an import list...That would require SOAP::Lite->import(@list). And you probably want to wrap this logic in a BEGIN {} block.

Replies are listed 'Best First'.
Re^2: Loading a module at runtime
by Anonymous Monk on May 05, 2011 at 02:46 UTC
    Just an FYI, this is how I finally got it working:
    if ($DEBUG) { eval "use SOAP::Lite; SOAP::Lite->import(+trace => 'debug');"; } else { eval "use SOAP::Lite;"; }
      use SOAP::Lite; use if $DEBUG, qw[ SOAP::Lite +trace debug ];