Any way to "inject" an INIT block into a different module?

Marcel Grünauer gr at univie.ac.at
Fri May 30 14:38:22 BST 2008


On May 30, 2008, at 2:26 PM, Andy Wardley wrote:

>    use Control qw( sex drugs );
>
>    # later...
>    eval "use Amp";
>    Amp->volume;
>    Amp->sustain;

use() = require() + import()

eval() doesn't have the import() part, so you need to call it manually.

Can't think of another way short of running your whole program in a  
BEGIN block. :)

Marcel



More information about the london.pm mailing list