in reply to Problems with Safe compartment reval parameters

Aside from the missing use Safe;, share says "Each NAME must be the name of a non-lexical variable" (emphasis mine). You successfully shared %main::params, which isn't too useful since you never put a value in it.

Replies are listed 'Best First'.
Re^2: Problems with Safe compartment reval parameters
by winneymj (Initiate) on Sep 28, 2009 at 02:30 UTC

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

    Thanks

      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

      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.