Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Perl
tree: e3973dc115

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/Class
t
xt
.gitignore
.shipit
Build.PL
Changes
MANIFEST
MANIFEST.SKIP
README.pod

README.pod

NAME

Class::Extendable - Extendable like Ruby's `singleton method`

SYNOPSIS

  package My::Foo;
  use Class::Extendable;
  sub new { bless {}, shift }

  package My::Bar;
  sub bar {}

  package main;
  my $obj1 = My::Foo->new;
  my $obj2 = My::Foo->new;

  ok !$obj1->can('bar');
  ok !$obj2->can('bar');

  $obj1->extend('My::Bar');

  # Now that `$obj1` extended, it can receive all the methods in `My::Bar`
  ok $obj1->can('bar');
  ok !$obj2->can('bar');

DESCRIPTION

Class::Extendable provides a feature like Ruby's `singleton method`. Once some object is extended with other classes, only that object can receive all the methods in those classes, without affecting the object's class.

AUTHOR

Kentaro Kuribayashi <kentarok@gmail.com>

SEE ALSO

LICENSE

Copyright (C) Kentaro Kuribayashi

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Something went wrong with that request. Please try again.