MooseX::FunkyAttributes::Role::Attribute::InsideOut - an inside-out attribute
package Person; use Moose; use MooseX::FunkyAttributes; has name => ( traits => [ InsideOutAttribute ], is => 'ro', isa => 'Str', ); has age => ( is => 'ro', isa => 'Num', ); package main; use feature 'say'; my $bob = Person->new(name => 'Bob', age => 32); say $bob->name; # Bob say $bob->dump; # $VAR1 = bless({ age => 32 }, 'Person');
This trait implements the "inside-out" technique for Moose attributes. Unlike MooseX::InsideOut it doesn't make all attributes in the class inside-out; just the attribute(s) it is applied to.
One situation where you might want to do this is to hide certain attributes from dumps. For example, a "password" attribute that you don't want to appear in log files, or an attribute which contains a large chunk of textual data or a deeply nested data structure which makes the logs less readable.
This trait inherits from MooseX::FunkyAttributes::Role::Attribute, but forget about most of what you read in the documentaton for that trait. Those custom_set, custom_get, custom_inline_set, etc options are all automatically generated for you.
custom_set
custom_get
custom_inline_set
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=MooseX-FunkyAttributes.
MooseX::FunkyAttributes, MooseX::InsideOut, Hash::FieldHash.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2012-2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install MooseX::FunkyAttributes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::FunkyAttributes
CPAN shell
perl -MCPAN -e shell install MooseX::FunkyAttributes
For more information on module installation, please visit the detailed CPAN module installation guide.