.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "MRO::Compat 3"
.TH MRO::Compat 3 "2017-03-28" "perl v5.16.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
MRO::Compat \- mro::* interface compatibility for Perls < 5.9.5
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 4
\& 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(\*(AqFooClass\*(Aq);
\& print join(q{, }, @$linear);
\&
\& # Prints: FooClass, X, PPP, Exporter, Y, Z
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \*(L"mro\*(R" namespace provides several utilities for dealing
with method resolution order and method caching in general
in Perl 5.9.5 and higher.
.PP
This module provides those interfaces for
earlier versions of Perl (back to 5.6.0 anyways).
.PP
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+.
.PP
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.
.PP
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.
.PP
This module never exports any functions. All calls must
be fully qualified with the \f(CW\*(C`mro::\*(C'\fR prefix.
.PP
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.
.SH "Functions"
.IX Header "Functions"
.ie n .SS "mro::get_linear_isa($classname[, $type])"
.el .SS "mro::get_linear_isa($classname[, \f(CW$type\fP])"
.IX Subsection "mro::get_linear_isa($classname[, $type])"
Returns an arrayref which is the linearized \*(L"\s-1ISA\*(R"\s0 of the given class.
Uses whichever \s-1MRO\s0 is currently in effect for that class by default,
or the given \s-1MRO \s0(either \f(CW\*(C`c3\*(C'\fR or \f(CW\*(C`dfs\*(C'\fR if specified as \f(CW$type\fR).
.PP
The linearized \s-1ISA\s0 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.
.PP
Note that \f(CW\*(C`UNIVERSAL\*(C'\fR (and any members of \f(CW\*(C`UNIVERSAL\*(C'\fR's \s-1MRO\s0) are not
part of the \s-1MRO\s0 of a class, even though all classes implicitly inherit
methods from \f(CW\*(C`UNIVERSAL\*(C'\fR and its parents.
.SS "mro::import"
.IX Subsection "mro::import"
This allows the \f(CW\*(C`use mro \*(Aqdfs\*(Aq\*(C'\fR and
\&\f(CW\*(C`use mro \*(Aqc3\*(Aq\*(C'\fR syntaxes, providing you
\&\*(L"use MRO::Compat\*(R" first. Please see the
\&\*(L"\s-1USING C3\*(R"\s0 section for additional details.
.ie n .SS "mro::set_mro($classname, $type)"
.el .SS "mro::set_mro($classname, \f(CW$type\fP)"
.IX Subsection "mro::set_mro($classname, $type)"
Sets the mro of \f(CW$classname\fR to one of the types
\&\f(CW\*(C`dfs\*(C'\fR or \f(CW\*(C`c3\*(C'\fR. Please see the \*(L"\s-1USING C3\*(R"\s0
section for additional details.
.SS "mro::get_mro($classname)"
.IX Subsection "mro::get_mro($classname)"
Returns the \s-1MRO\s0 of the given class (either \f(CW\*(C`c3\*(C'\fR or \f(CW\*(C`dfs\*(C'\fR).
.PP
It considers any Class::C3\-using class to have C3 \s-1MRO\s0
even before \fIClass::C3::initialize()\fR is called.
.SS "mro::get_isarev($classname)"
.IX Subsection "mro::get_isarev($classname)"
Returns an arrayref of classes who are subclasses of the
given classname. In other words, classes in whose \f(CW@ISA\fR
hierarchy we appear, no matter how indirectly.
.PP
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.
.SS "mro::is_universal($classname)"
.IX Subsection "mro::is_universal($classname)"
Returns a boolean status indicating whether or not
the given classname is either \f(CW\*(C`UNIVERSAL\*(C'\fR itself,
or one of \f(CW\*(C`UNIVERSAL\*(C'\fR's parents by \f(CW@ISA\fR inheritance.
.PP
Any class for which this function returns true is
\&\*(L"universal\*(R" in the sense that all classes potentially
inherit methods from it.
.SS "mro::invalidate_all_method_caches"
.IX Subsection "mro::invalidate_all_method_caches"
Increments \f(CW\*(C`PL_sub_generation\*(C'\fR, which invalidates method
caching in all packages.
.PP
Please note that this is rarely necessary, unless you are
dealing with a situation which is known to confuse Perl's
method caching.
.SS "mro::method_changed_in($classname)"
.IX Subsection "mro::method_changed_in($classname)"
Invalidates the method cache of any classes dependent on the
given class. In MRO::Compat on pre\-5.9.5 Perls, this is
an alias for \f(CW\*(C`mro::invalidate_all_method_caches\*(C'\fR above, as
pre\-5.9.5 Perls have no other way to do this. It will still
enforce the requirement that you pass it a classname, for
compatibility.
.PP
Please note that this is rarely necessary, unless you are
dealing with a situation which is known to confuse Perl's
method caching.
.SS "mro::get_pkg_gen($classname)"
.IX Subsection "mro::get_pkg_gen($classname)"
Returns an integer which is incremented every time a local
method of or the \f(CW@ISA\fR of the given package changes on
Perl 5.9.5+. On earlier Perls with this MRO::Compat module,
it will probably increment a lot more often than necessary.
.SH "USING C3"
.IX Header "USING C3"
While this module makes the 5.9.5+ syntaxes
\&\f(CW\*(C`use mro \*(Aqc3\*(Aq\*(C'\fR and \f(CW\*(C`mro::set_mro("Foo", \*(Aqc3\*(Aq)\*(C'\fR available
on older Perls, it does so merely by passing off the work
to Class::C3.
.PP
It does not remove the need for you to call
\&\f(CW\*(C`Class::C3::initialize()\*(C'\fR, \f(CW\*(C`Class::C3::reinitialize()\*(C'\fR, and/or
\&\f(CW\*(C`Class::C3::uninitialize()\*(C'\fR 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+.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Class::C3
.PP
mro
.SH "AUTHOR"
.IX Header "AUTHOR"
Brandon L. Black, <blblack@gmail.com>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright 2007\-2008 Brandon L. Black <blblack@gmail.com>
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.