Class::Mutator

Run-time Dynamic Multiple Inheritance
Download

Class::Mutator Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Greg McCarroll
  • Publisher web site:
  • http://search.cpan.org/~gmccar/

Class::Mutator Tags


Class::Mutator Description

Run-time Dynamic Multiple Inheritance Class::Mutator is a Perl module that adds the power of "dynamic polymorphism" to Perl objects.Any object that inherits Class::Mutator principally gains two new methods, mutate and unmutate that allows them to add methods to themselves at runtime from other packages. The most recently mutated packages take precedence when methods with the same name are defined in more than one package.This module is similar to Sex.pm, which Michael Schwern was working on around the same time, only a little bit more predictable. It came about while I was doing some training at the BBC and someone asked how you could do this easily; after discussion with my fellow London.pm'ers, in particular Piers Cawley, this module came about.More recently Matthew Simon Cavalletto sent me a version with everything I had been meaning to do on the module a little after I uploaded version 0.03 which only had more substantial tests. So major kudos to Matthew.SYNOPSIS package Frog; use Class::Mutator qw( -isasubclass ); sub new { ... } sub eat_flies { ... } package Prince; sub be_charming { ... } my $froggie = Frog->new; $froggie->mutate('Prince'); # Now the froggie has been reblessed into a "Frog Prince" # class and can take advantage of methods in both classes. $froggie->eat_flies; $froggie->be_charming; Requirements: · Perl


Class::Mutator Related Software