NAME

Simo::Util - Utility Class for Simo

VERSION

Version 0.01_03

SYNOPSIS

use Simo::Util qw( o );

my( $title, $author ) = o($book)->get_attrs( 'title', 'author' );

my %hash = o($book)->get_attrs_as_hash( 'title', 'author' );
my $hash_ref = o($book)->get_attrs_as_hash( 'title', 'author' );

o($book)->set_attrs( title => 'Simple OO', author => 'kimoto' );

my $result = o($book_list)->run_methods(
    'select' => [ type => 'Commic' ],
    'sort' => [ 'desc' ],
    'get_result'
);

EXPORT

By default, no funcion is exported.

All functions can be exported.

use Simo::Util qw( o );

o() functions

o() is object wrapper.

wrapped object use useful methods provided by Simo::Wrapper.

Simo::Wrapper methods

get_attrs

You can get multiple attrs value.

my( $title, $author ) = o($book)->get_attrs( 'title', 'author' );

get_attrs_as_hash

You can get multiple attrs value as hash or hash ref.

my %hash = o($book)->get_attrs_as_hash( 'title', 'author' );

or

my $hash_ref = o($book)->get_attrs_as_hash( 'title', 'author' );

set_attrs

You can set multiple attrs valule.

o($book)->set_attrs( title => 'Simple OO', author => 'kimoto' );

This method return wrapped object. so you can call method continuous.

o($book)->set_attrs( title => 'good news' )->run_methods( 'sort' );

run_methods

This run some methods continuous.

my $result = o($book_list)->run_methods(
    'select' => [ type => 'Commic' ],
    'sort' => [ 'desc' ],
    'get_result'
);

Method args must be array ref. Please be carefull not to specify scalar or list.

my $result = o($book_list)->run_methods(
    'select' => ( type => 'Commic' ), # this is not work.
    'sort' => 'desc', # this is also not work.
);

You can omit args.

my $result = o($book_list)->run_methods(
    'get_result' # omit args
);

You can get last method return value.

new

AUTHOR

Yuki Kimoto, <kimoto.yuki at gmail.com>

BUGS

Please report any bugs or feature requests to bug-simo-util at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Simo-Util. 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::Util

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 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.