NAME
Object::Simple - Simple OO framework
VERSION
Version 3.0101
SYNOPSIS
package Book;
use base 'Object::Simple::Base';
__PACKAGE__->attr('title');
__PACKAGE__->attr(pages => 159);
__PACKAGE__->attr([qw/authors categories/] => sub { [] });
__PACKAGE__->class_attr('foo');
__PACKAGE__->class_attr(foo => 1);
__PACAKGE__->class_attr('foo', default => 1, inherit => 'scalar');
__PACKAGE__->dual_attr('bar');
__PACAKGE__->dual_attr(bar => 2);
__PACAKGE__->dual_attr('bar', default => 1, inherit => 'scalar');
package main;
use Book;
my $book = Book->new;
print $book->pages;
print $book->pages(5)->pages;
my $my_book = Car->new(title => 'Good Day');
print $book->authors(['Ken', 'Tom'])->authors;
Book->foo('a');
Book->bar('b');
$book->bar('c');
DESCRIPTION
Object::Simple is a simple OO framework.
By using Object::Simple, you will be exempt from the bitter work of repeatedly writing the new() constructor and the accessors.
Object::Simple contains three classes. Object::Simple::Base, Object::Simple::Accessor Object::Simple itself is just a name space.
Object::Simple::Base is a base class of a class. It provides new(), which is a constructor, and attr(), class_attr(), dual_attr(), which is the methods to create a accessor.
Object::Simple::Base is compatible of Mojo::Base. If you like Mojo:Base, Object::Simple::Base is a good select.
Object::Simple::Accessor provides accessor creating methods(attr(), class_attr(), dual_attr()) to Mojo::Base. This is useful to provide only a accessor creating ability to your class.
Copyright & license
Copyright 2008 Yuki Kimoto, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.