Richard Soderberg > Class-Methods > Class::Methods

Download:
Class-Methods-0.062.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.062   Source  

NAME ^

Class::Methods - Object methods for working with classes

SYNOPSIS ^

  use Class::Methods;
  
  my $container = bless [], Class::Methods->new(
    count => sub { return scalar @{$_[0]} },
  );

  print $container->count; # prints 0

  $container->extend( push => sub { push @{$_[0]}, $_[1..$#_] } );

  $container->push( qw[apples oranges] );

  $container->remove( "push" );

  print $container->count; # prints 2

  # XXX: $container->base('ARRAY'); # import push(), pop(), splice(), etc.

DESCRIPTION ^

After discussing Ruby with Simon, I wrote this module to implement OO in Perl via the builtin inheritance-based method system.

It seems to be pretty fun to work with. Kind of resesmbles ruby, though, and I suspect it might start enroaching on Perl 6.

This is the first release, to share the madness with y'all. I've planned serious uses of this module, so perhaps it'll find a good home.

test.pl is the only code example right. The core's small, and fun to read.

AUTHOR ^

Richard Soderberg, rsod@cpan.org

SEE ALSO ^

Class::Object

syntax highlighting: