Class::C3

A pragma to use the C3 method resolution order algortihm
Download

Class::C3 Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Florian Ragwitz
  • Publisher web site:
  • http://search.cpan.org/~flora/

Class::C3 Tags


Class::C3 Description

A pragma to use the C3 method resolution order algortihm Class::C3 is a pragma to use the C3 method resolution order algortihm.SYNOPSIS package A; use Class::C3; sub hello { 'A::hello' } package B; use base 'A'; use Class::C3; package C; use base 'A'; use Class::C3; sub hello { 'C::hello' } package D; use base ('B', 'C'); use Class::C3; # Classic Diamond MI pattern # < A > # / # < B > < C > # / # < D > package main; # initializez the C3 module # (formerly called in INIT) Class::C3::initialize(); print join ', ' => Class::C3::calculateMRO('Diamond_D') # prints D, B, C, A print D->hello() # prints 'C::hello' instead of the standard p5 'A::hello' D->can('hello')->(); # can() also works correctly UNIVERSAL::can('D', 'hello'); # as does UNIVERSAL::can()This is pragma to change Perl 5's standard method resolution order from depth-first left-to-right (a.k.a - pre-order) to the more sophisticated C3 method resolution order. Requirements: · Perl


Class::C3 Related Software