Class::AutoAccess::Deep - automatically creates the accessors reach deep inside the field
package MyClass; # inherit Class::AutoAccess::Deep and that's all use base qw(Class::AutoAccess::Deep); sub to_check { # write your own processing code... } package main; $data = { foo => undef, bar => { baz => undef, }, to_check => undef, }; my $obj = MyClass->new($data); # now, you can access the fields as described below $obj->foo('new value'); # set "new value" my $foo = $obj->foo; # get "new value" # you can access the field chain deeply # by joining field name with '->' $obj->bar->baz('other value'); # set "other value" my $bar_baz = $obj->bar->baz; # get "other value" # your own method called correctly my $value = $obj->to_check;
Class::AutoAccess::Deep is the base class for automated accessors implementation. You can access deep inside the object fields to call the method named by joining the object field name with '->' operator.
my $obj = MyClass->new(\%fields);
Creates and returns new object. It takes a hashref which is used to initialize the object. If you don't like it, override it.
When you attempt to access the undefined field, Class::AutoAccess::Deep object throws exception using Carp::croak.
Store the accessors which is called once into somewhere for performance reason
Makamaka, http://www.donzoko.net/
Naoya Ito, http://d.hatena.ne.jp/naoya/
Yappo, http://blog.yappo.jp/
YAMASHINA Hio, http://fleur.hio.jp/
Topia, http://www.clovery.jp/
Kentaro Kuribayashi, <kentaro@cpan.org>
Copyright (C) 2005 by Kentaro Kuribayashi
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Class::AutoAccess::Deep, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::AutoAccess::Deep
CPAN shell
perl -MCPAN -e shell install Class::AutoAccess::Deep
For more information on module installation, please visit the detailed CPAN module installation guide.