in reply to Inheritable configuration options.... but with default values?

I can spot at least two issues:

you most likely want either

local $cfg{on_error} = "warn";

or

my %cfg=( # now my to avoid overwriting any glob +al %cfg %cfg, # inherited defaults * on_error => "warn", );

(untested)

edit

and in the second case you won't even need inheritance because with pkg-vars you can be explicit

my %cfg=( # now my to avoid overwriting any glob +al %cfg %base::cfg, # inherited defaults * on_error => "warn", );

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

update

added local and my

update

There are more options ... but the expected behavior is not clear to me ...

To answer this properly we'd need to see an SSCCE

update

*) fixed error in order, swl++

Replies are listed 'Best First'.
Re^2: Inheritable configuration options.... but with default values? (updated)
by swl (Prior) on Feb 20, 2020 at 20:57 UTC

    This order of hash entries will mean the global values override the local.

    It should be:

    my %cfg=( %base::cfg, on_error => "warn", );
      Of course you are totally right.

      I was probably too occupied puzzling about the intended semantics.

      Fixed!

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery