ArrayBasedStorage - An example of an Array based instance storage
package Foo; use metaclass ( ':instance_metaclass' => 'ArrayBasedStorage::Instance' ); __PACKAGE__->meta->add_attribute('foo' => ( reader => 'get_foo', writer => 'set_foo' )); sub new { my $class = shift; $class->meta->new_object(@_); } # now you can just use the class as normal
This is a proof of concept using the Instance sub-protocol which uses ARRAY refs to store the instance data.
This is very similar now to the InsideOutClass example, and in fact, they both share the exact same test suite, with the only difference being the Instance metaclass they use.
Stevan Little <stevan@iinteractive.com>
Yuval Kogman <nothingmuch@woobling.com>
Copyright 2006-2008 by Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Moose, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moose
CPAN shell
perl -MCPAN -e shell install Moose
For more information on module installation, please visit the detailed CPAN module installation guide.