Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 t
Octocat-spinner-32 xt
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .shipit
Octocat-spinner-32 Build.PL
Octocat-spinner-32 Changes
Octocat-spinner-32 MANIFEST
Octocat-spinner-32 MANIFEST.SKIP
Octocat-spinner-32 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.