package PPP; use base qw/Exporter/; package X; use base qw/PPP/; package Y; use base qw/PPP/; package Z; use base qw/PPP/; package FooClass; use base qw/X Y Z/; package main; use MRO::Compat; my $linear = mro::get_linear_isa('FooClass'); print join(q{, }, @$linear); # Prints: FooClass, X, PPP, Exporter, Y, Z
This module provides those interfaces for earlier versions of Perl (back to 5.6.0 anyways).
It is a harmless no-op to use this module on 5.9.5+. That is to say, code which properly uses MRO::Compat will work unmodified on both older Perls and 5.9.5+.
If you're writing a piece of software that would like to use the parts of 5.9.5+'s mro:: interfaces that are supported here, and you want compatibility with older Perls, this is the module for you.
Some parts of this code will work better and/or faster with Class::C3::XS installed (which is an optional prereq of Class::C3, which is in turn a prereq of this package), but it's not a requirement.
This module never exports any functions. All calls must be fully qualified with the "mro::" prefix.
The interface documentation here serves only as a quick reference of what the function basically does, and what differences between MRO::Compat and 5.9.5+ one should look out for. The main docs in 5.9.5's mro are the real interface docs, and contain a lot of other useful information.
The linearized ISA of a class is a single ordered list of all of the classes that would be visited in the process of resolving a method on the given class, starting with itself. It does not include any duplicate entries.
Note that "UNIVERSAL" (and any members of "UNIVERSAL"'s MRO) are not part of the MRO of a class, even though all classes implicitly inherit methods from "UNIVERSAL" and its parents.
It considers any Class::C3-using class to have C3 MRO even before Class::C3::initialize() is called.
This is much slower on pre-5.9.5 Perls with MRO::Compat than it is on 5.9.5+, as it has to search the entire package namespace.
Any class for which this function returns true is ``universal'' in the sense that all classes potentially inherit methods from it.
Please note that this is rarely necessary, unless you are dealing with a situation which is known to confuse Perl's method caching.
Please note that this is rarely necessary, unless you are dealing with a situation which is known to confuse Perl's method caching.
It does not remove the need for you to call "Class::C3::initialize()", "Class::C3::reinitialize()", and/or "Class::C3::uninitialize()" at the appropriate times as documented in the Class::C3 docs. These three functions are always provided by MRO::Compat, either via Class::C3 itself on older Perls, or directly as no-ops on 5.9.5+.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.