in reply to Re: Problems with Safe compartment reval parameters
in thread Problems with Safe compartment reval parameters

Just updated the code example to make it more clear the initialization of the hash.

Thanks
  • Comment on Re^2: Problems with Safe compartment reval parameters

Replies are listed 'Best First'.
Re^3: Problems with Safe compartment reval parameters
by GrandFather (Saint) on Sep 28, 2009 at 02:44 UTC

    The important bit is that my %params ... declares a lexical variable. share only deals with package variables: %params ... which may make it less useful when strictures (use strict; use warnings;) are used (using strictures is highly recommended btw).


    True laziness is hard work
Re^3: Problems with Safe compartment reval parameters
by ikegami (Patriarch) on Sep 28, 2009 at 02:53 UTC

    Yes, you are initialising a hash, but not the one the one you're sharing. share shares package variables — %main::params in this case — but you're initialising a lexical (my) variable.

    Change my %params to local our %params.