NAME
Simo - Very simple framework for Object Oriented Perl.
VERSION
Version 0.09_03
CAUTION
Simo is yet experimenta stage.
Please wait until Simo will be stable.
FEATURES
Simo is framework that simplify Object Oriented Perl.
The feature is that
- 1. You can define accessors in very simple way.
- 2. new method is prepared.
- 3. You can define default value of attribute.
- 4. Error object is thrown, when error is occured.
If you use Simo, you are free from bitter work writing new methods and accessors repeatedly.
SYNOPSIS
Class definition
Using class
use
Book;
my
$book
= Book->new(
title
=>
'a'
,
author
=>
'b'
,
price
=> 1000 );
Default value of attribute
sub
author{ ac
default
=>
'Kimoto'
}
Constraint of attribute setting
sub
price{ ac
constrain
=>
sub
{ is_int } }
sub
author{ ac
constrain
=>
sub
{ isa
'Person'
} }
Filter of attribute setting
sub
author{ ac
filter
=>
sub
{
uc
} }
Trigger of attribute setting
sub
date{ ac
trigger
=>
sub
{
$_
->year(
substr
(
$_
->date, 0, 4 ) ) } }
sub
year{ ac }
Read only accessor
sub
year{ ac
read_only
=> 1 }
Hash ref convert of attribute setting
sub
country_id{ ac
hash_force
=> 1 }
Required attributes
sub
REQUIRED_ATTRS{
qw( title author )
}
Inheritance
Mixin
Manual
See Simo::Manual.
I explain detail of Simo.
If you are Japanese, See also Simo::Manual::Japanese.
FUNCTIONS
ac
ac is exported. This is used to define accessor.
METHODS
new
new method is prepared.
use
Book;
my
$book
= Book->new(
title
=>
'a'
,
author
=>
'b'
,
price
=> 1000 );
REQUIRED_ATTRS
this method is expected to override.
You can define required attribute.
SEE ALSO
Simo::Constrain - Constraint methods for Simo 'constrain' option.
Simo::Error - Structured error system for Simo.
Simo::Util - Utitlity class for Simo.
Simo::Wrapper - provide useful methods for object.
CAUTION
set_hook and get_hook option is now not recommended. These option will be removed in future 2019/01/01
non named defalut value definition is now not recommended. This expression will be removed in future 2019/01/01
sub
title{ ac
'OO tutorial'
}
# not recommend. cannot be available in future.
get_attrs,get_attrs_as_hash,set_attrs,run_methods is now not recommended. These methods will be removed in future 2019/01/01
AUTHOR
Yuki Kimoto, <kimoto.yuki at gmail.com>
BUGS
Please report any bugs or feature requests to bug-simo at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Simo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Simo
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SIMILAR MODULES
Class::Accessor,Class::Accessor::Fast, Moose, Mouse.
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.