项目作者: bluefeet

项目描述 :
Make your attributes chainable.
高级语言: Perl
项目地址: git://github.com/bluefeet/MooX-ChainedAttributes.git
创建时间: 2014-08-22T21:00:11Z
项目社区:https://github.com/bluefeet/MooX-ChainedAttributes

开源协议:Other

下载


NAME

MooX::ChainedAttributes - Make your attributes chainable.

SYNOPSIS

  1. package Foo;
  2. use Moo;
  3. use MooX::ChainedAttributes;
  4. has name => (
  5. is => 'rw',
  6. chained => 1,
  7. );
  8. has age => (
  9. is => 'rw',
  10. );
  11. chain('age');
  12. sub who {
  13. my ($self) = @_;
  14. print "My name is " . $self->name() . "!\n";
  15. }
  16. my $foo = Foo->new();
  17. $foo->name('Fred')->who(); # My name is Fred!

DESCRIPTION

This module exists for your method chaining enjoyment. It
was originally developed in order to support the porting of
MooseX::Attribute::Chained using classes to Moo.

In Moose you would write:

  1. package Bar;
  2. use Moose;
  3. use MooseX::Attribute::Chained;
  4. has baz => ( is=>'rw', traits=>['Chained'] );

To port the above to Moo just change it to:

  1. package Bar;
  2. use Moo;
  3. use MooX::ChainedAttributes;
  4. has baz => ( is=>'rw', chained=>1 );

AUTHOR

  1. Aran Clary Deltac <bluefeet@gmail.com>

CONTRIBUTORS

  1. Graham Knop <haarg@haarg.org>

LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.