get_pkg_gen#
Return a counter that increments every time a local method in $class changes or its local @ISA is modified.
Synopsis#
my $gen = mro::get_pkg_gen($class);
Useful to class-introspection code that wants a cheap “has anything I care about changed since last time?” check. Store the value, do your work, compare the next value against the stored one. Equal values mean nothing local changed; unequal values mean something did, but you still have to investigate what.
Changes in superclasses do not bump this number — only edits
inside $class itself. A stash instantiated for a normal package
starts at 1; $class with no stash at all returns 0. Wiping
a stash (undef %Pkg::) can reset the counter to 0 or 1
depending on how thorough the wipe was.