| Class-Implant documentation | view source | Contained in the Class-Implant distribution. |
version 0.01
There are two ways to use Class::Implant.
procedural way as follow.
package main;
use Class::Implant;
implant qw(Foo::Bar Less::More) { into => "Cat" } # import all methods in Foo::Bar and Less::More into Cat
or in classical way. just using caller as default target for implanting.
package Cat;
use Class::Implant;
implant qw(Less::More); # mixing all methods from Less::More,
# like ruby 'include'
implant qw(Foo::Bar), { inherit => 1 }; # import all methods from Foo::Bar and inherit it
# it just do one more step: unshift Foo::Bar into @ISA
# this step is trivial in Perl
# but present a verisimilitude simulation of inheritance in Ruby
Class::Implant allow you manipulating mixin and inheritance outside of packages.
syntax is like
use Class::Implant;
implant @classes_for_injection, { options => value }
available options show as following.
target package for injection.
give 1 or any value to mark the inheritance
this option is not available in 0.01
this option is not available in 0.01
implant()
shelling <shelling@cpan.org>
This software is Copyright (c) 2009 by shelling <shelling@cpan.org>.
This is free software, licensed under:
The MIT (X11) License
| Class-Implant documentation | view source | Contained in the Class-Implant distribution. |