Data::OpenStruct::Deep - allows you to create data objects and set arbitrary attributes deeply
use Data::OpenStruct::Deep; my %hash = ( foo => 1, bar => { baz => 2, }, ); my $struct = Data::OpenStruct::Deep->new(%hash); my $foo = $struct->foo; #=> 1 my $bar = $struct->bar; #=> { baz => 2 } my $baz = $struct->bar->baz; #=> 2 my $empty = Data::OpenStruct::Deep->new; $empty->foo->bar->baz->quux('deeply'); # deeply, ok print $empty->foo->bar; #=> { baz => { quux => "deeply" } } print $empty->foo->bar->baz->quux; #=> "deeply"
This module allows you to create data objects and set arbitrary attributes.
It is like a hash with a different way to access the data. In fact, it is implemented with a hash and AUTOLOAD, and you can initialize it with one.
AUTOLOAD
NAKAGAWA Masaki <masaki@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Hash::AsObject, Object::AutoAccessor, Hash::Inflator,
http://www.ruby-doc.org/stdlib/libdoc/ostruct/rdoc/classes/OpenStruct.html
To install Data::OpenStruct::Deep, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::OpenStruct::Deep
CPAN shell
perl -MCPAN -e shell install Data::OpenStruct::Deep
For more information on module installation, please visit the detailed CPAN module installation guide.