Simo - Very simple framework for Object Oriented Perl.
Version 0.1001
Simo is yet experimenta stage.
Please wait until Simo will be stable.
Simo is framework that simplify Object Oriented Perl.
The feature is that
If you use Simo, you are free from bitter work writing new methods and accessors repeatedly.
package Book; use Simo; sub title{ ac } sub author{ ac } sub price{ ac }
use Book; my $book = Book->new( title => 'a', author => 'b', price => 1000 );
sub author{ ac default => 'Kimoto' }
use Simo::Constrain qw( is_int isa ); sub price{ ac constrain => sub{ is_int } } sub author{ ac constrain => sub{ isa 'Person' } }
sub author{ ac filter => sub{ uc } }
sub date{ ac trigger => sub{ $_->year( substr( $_->date, 0, 4 ) ) } } sub year{ ac }
sub year{ ac read_only => 1 }
sub country_id{ ac hash_force => 1 }
sub REQUIRED_ATTRS{ qw( title author ) }
package Magazine; use Simo( base => 'Book' );
package Book; use Simo( mixin => 'Class::Cloneable' );
See Simo::Manual.
I explain detail of Simo.
If you are Japanese, See also Simo::Manual::Japanese.
ac is exported. This is used to define accessor.
and_super is exported. This is used to call super method for REQUIRED_ATTRS.
sub REQUIRED_ATTRS{ 'm1', 'm2', and_super }
new method is prepared.
new_self_and_parent resolve the inheritance of no Simo based class;
$self->new_self_and_parent( @_, [ 'title', 'author' ] ); $self->new_self_and_parent( { self_args => [], parent_args => [] } );
this method is expected to override.
You can define required attribute.
package Book; use Simo; sub title{ ac } sub author{ ac } sub price{ ac } sub REQUIRED_ATTRS{ qw( title author ) }
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.
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
Yuki Kimoto, <kimoto.yuki at gmail.com>
<kimoto.yuki at gmail.com>
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.
bug-simo at rt.cpan.org
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
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Simo
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Simo
CPAN Ratings
http://cpanratings.perl.org/d/Simo
Search CPAN
http://search.cpan.org/dist/Simo/
Class::Accessor,Class::Accessor::Fast, Moose, Mouse.
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.
To install DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DB
CPAN shell
perl -MCPAN -e shell install DB
For more information on module installation, please visit the detailed CPAN module installation guide.