coercing method arguments in MooseX::Declare

[email protected]
Newsgroups perl.moose
Message-ID <753596831.2427405.1349116395946.JavaMail.root@sz0115a.emeryville.ca.mail.comcast.net>
Hi, 


I wonder if coercion works on method arguments when using MooseX::Declare? 


I tried and could not make it work, maybe I expect too much. 




use MooseX::Declare; 


class Foo { 
use Moose::Util::TypeConstraints; 


subtype Target as 'Object' => where { 
$_->can('update') 
}; 



coerce Target => from 'Str' => via { 
$_->new_with_options; 
}; 
}; 


# How to specify coerce =>1 here ? 
method add_target (Target $target! ) { 


} 
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.