The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Class::Mutator

SYNOPSIS

DESCRIPTION

Class::Mutator adds the power of 'dynamic polymorphism' to Perl objects, its similar to Michael Schwern's Sex.pm which he was working on around the same time, only a little bit more predictable.

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. With most recently mutated packages having precedence when methods are defiend in more than one package.

This module 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.

TODO

Lots to be done at the minute it requires the extremely useful Memoize module, this module as always allows be to increase performance without having to think i'm going to write some code that retains performance if Memoize is not installed.

I'm also going to take Michael Schwern's idea of Sex.pm choosing method precendence randomly and write an Agent::Sex on top of Steve Purkis' Agent framework so we can start to do some evolutionary Agents in Perl.

METHODS

build_mutation_package(@package_names)

Builds the new mutation package.

build_package_list(operation,package)

Builds a new package list based on the current packages list and the operation and package (the operation is upon) handed to this method.

unmutate

Remove mutation abilities via a package

mutate

Adds a mutation.

AUTHOR

Greg McCarroll (greg@mccarroll.demon.co.uk)