set_mro#

Set the method-resolution algorithm for $class to either "dfs" or "c3".

Synopsis#

mro::set_mro($class, ‘c3’); mro::set_mro($class, ‘dfs’);

After the call, subsequent method dispatches on $class — and subclasses that inherit the setting — walk the chosen linearization. get_linear_isa($class) reflects the new choice on the next invocation.

Any value other than "dfs" or "c3" croaks with Invalid mro name: '...'. Usage with any argument count other than two croaks with Usage: mro::set_mro(classname, type). The stash for $class is created on demand if it does not yet exist, so selecting an MRO before the package is declared works.