On Wed, Mar 11, 2009 at 7:27 PM, Derek Price <de...@ximbiot.com> wrote:
> Actually, I'd be as happy with chained setters - it just bothers me to
> see a useless return value.  I'll keep both ideas in mind, thanks!

It's not *exactly* useless, take the following example:


use 5.10.0;

package Dog;
use Moose;
has name => ( isa => 'Str', is => 'ro' );

package PuppyFarm;
use Moose;
use Moose::Util::TypeConstraints;

class_type 'Dog';
coerce "Dog" => from 'Str' => via { Dog->new(name => $_) };

has dog => ( isa => 'Dog', is => 'rw', coerce => 1);


package main;

my $o = PuppyFarm->new();
my $dog = $o->dog("Spot");
say ref $dog;
say $dog->dump;


The value stored isn't always the value submitted.

Reply via email to