MooseX::AttributeFilter::Trait::Attribute - trait for filtered attributes
package My::Class; use Moose; use MooseX::AttributeFilter; has field => ( is => 'rw', filter => 'filterField', ); sub filterField { my $this = shift; return "filtered($_[0])"; } package main; My::Class->meta->get_attribute("field")->has_filter; # true
MooseX::AttributeFilter::Trait::Attribute is a trait for Moose::Meta::Attribute. MooseX::AttributeFilter automatically applies it to all attributes, but it acts as no-op if attribute does not use filter option.
filter
Returns the value of the filter option. This may be a string (method name) or coderef or undef.
has_filter
Boolean.
bypass_filter_method_check
has attr => ( is => 'rw', filter => 'my_filter_method', bypass_filter_method_check => 1, );
Can be used to make MooseX::AttributeFilter::Trait::Attribute not throw error message in case of my_filter_method method not exists. (Will still throw error if is called and cannot find method.) Used for edge cases like when filter method will be provided by AUTOLOAD or later added by trait.
my_filter_method
AUTOLOAD
MooseX::AttributeFilter.
Copyright (C) 2018 Little Princess Kitten <kitten@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
KITTEN <kitten@cpan.org>
https://metacpan.org/author/KITTEN
https://github.com/icklekitten
<3
To install MooseX::AttributeFilter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::AttributeFilter
CPAN shell
perl -MCPAN -e shell install MooseX::AttributeFilter
For more information on module installation, please visit the detailed CPAN module installation guide.