Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icklekitten/moosex-attributefilter
MooX::AttributeFilter with cute antlers OwO
https://github.com/icklekitten/moosex-attributefilter
moose-framework object-oriented-programming perl5
Last synced: 1 day ago
JSON representation
MooX::AttributeFilter with cute antlers OwO
- Host: GitHub
- URL: https://github.com/icklekitten/moosex-attributefilter
- Owner: icklekitten
- License: other
- Created: 2018-05-13T21:51:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-17T21:45:12.000Z (over 6 years ago)
- Last Synced: 2024-11-18T20:15:01.074Z (1 day ago)
- Topics: moose-framework, object-oriented-programming, perl5
- Language: Perl
- Homepage: https://metacpan.org/release/MooseX-AttributeFilter
- Size: 45.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# NAME
MooseX::AttributeFilter - MooX::AttributeFilter with cute antlers OwO
# SYNOPSIS
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 $obj = My::Class->new( field => "initial" );
$obj->field eq "filtered(initial)"; # True!# DESCRIPTION
MooseX::AttributeFilter is a port of [MooX::AttributeFilter](https://metacpan.org/pod/MooX::AttributeFilter) to [Moose](https://metacpan.org/pod/Moose).
A filter a method that is called before an attribute value is set (by accessor
or constructor). It is called before coercions, type checks, and triggers.It is called as a method (so receives the object) with the new attribute value
as its first parameter, and the old attribute value as the second parameter.
(When called from constructor, no old value, so only one parameter.) Its return
value is used as the attribute value.It is even called when an attribute value is build by builder methods or
defaults.See [MooX::AttributeFilter](https://metacpan.org/pod/MooX::AttributeFilter) for more details and for use cases.
# BUGS
Some parts don't work correctly in mutable classes. Mutable classes are slow anyway.
[https://rt.cpan.org/Dist/Display.html?Queue=MooseX-AttributeFilter](https://rt.cpan.org/Dist/Display.html?Queue=MooseX-AttributeFilter)
# CUTE
Cute.
# SEE ALSO
[MooX::AttributeFilter](https://metacpan.org/pod/MooX::AttributeFilter), [Moose](https://metacpan.org/pod/Moose).
[MooseX::AttributeFilter::Trait::Attribute](https://metacpan.org/pod/MooseX::AttributeFilter::Trait::Attribute),
[MooseX::AttributeFilter::Trait::Attribute::Role](https://metacpan.org/pod/MooseX::AttributeFilter::Trait::Attribute::Role).# LICENSE
Copyright (C) 2018 Little Princess Kitten
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.# AUTHOR
KITTEN
[https://metacpan.org/author/KITTEN](https://metacpan.org/author/KITTEN)
[https://github.com/icklekitten](https://github.com/icklekitten)
<3