X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FGetopt%2FMeta%2FAttribute.pm;h=70aaa615a3687006273dc2d02afa009a5d4aa46c;hb=75c37b0c2063f0029600645a9dff111631b87816;hp=fd89a3f10a6fd3a7c9b9cd3b9165deffc44eba01;hpb=1e592beebf132ad7bd641fc9c441f47eece0400b;p=gitmo%2FMooseX-Getopt.git diff --git a/lib/MooseX/Getopt/Meta/Attribute.pm b/lib/MooseX/Getopt/Meta/Attribute.pm index fd89a3f..70aaa61 100644 --- a/lib/MooseX/Getopt/Meta/Attribute.pm +++ b/lib/MooseX/Getopt/Meta/Attribute.pm @@ -24,7 +24,7 @@ sub register_implementation { 'MooseX::Getopt::Meta::Attribute' } with 'MooseX::Getopt'; has 'data' => ( - metaclass => ['Getopt'], + metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'file.dat', @@ -52,6 +52,17 @@ which L will create for you. This is certainly not the prettiest way to go about this, but for now it works for those who might need such a feature. +=head2 Use 'traits' instead of 'metaclass' + +You should rarely need to explicitly set the attribute metaclass. It is much +preferred to simply provide a trait (a role applied to the attribute +metaclass), which allows other code to futher modify the attribute by applying +additional roles. + +Therefore, you should first try to do this: + + has 'foo' => (traits => ['Getopt'], cmd_flag => 'f'); + =head2 Custom Metaclass alias This now takes advantage of the Moose 0.19 feature to support