From: Stevan Little Date: Thu, 3 May 2007 01:05:41 +0000 (+0000) Subject: 0.03 X-Git-Tag: 0_03~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3d9a716d3b164a29df44de04ceb99711c0583420;p=gitmo%2FMooseX-Getopt.git 0.03 --- diff --git a/ChangeLog b/ChangeLog index b133731..623594e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,17 @@ Revision history for Perl extension MooseX-Getopt -0.03 - * downgraded the Getopt version requirement +0.03 Wed. May 2nd, 2007 + ~ downgraded the Getopt version requirement to 2.35 as per RT #26844 + ~ adding blblack to the authors list + * MooseX::Getopt + - doc update to show simple way to of excluding + an attribute, but not having accessors with + underscores (thanks to Zaba on #moose for this) + * MooseX::Getopt::Meta::Attribute + - tightening up the type constraint in the + cmd_alias coercion to only accept strings 0.02 Friday, April 6, 2007 * MooseX::Getopt diff --git a/lib/MooseX/Getopt.pm b/lib/MooseX/Getopt.pm index 8c2f4b0..229b2be 100644 --- a/lib/MooseX/Getopt.pm +++ b/lib/MooseX/Getopt.pm @@ -114,7 +114,17 @@ to get non-default commandline option names and aliases. By default, attributes which start with an underscore are not given commandline argument support, unless the attribute's metaclass is set -to L. +to L. If you don't want you accessors +to have the leading underscore in thier name, you can do this: + + # for read/write attributes + has '_foo' => (accessor => 'foo', ...); + + # or for read-only attributes + has '_bar' => (reader => 'bar', ...); + +This will mean that Getopt will not handle a --foo param, but your +code can still call the C method. =head2 Supported Type Constraints diff --git a/lib/MooseX/Getopt/Meta/Attribute.pm b/lib/MooseX/Getopt/Meta/Attribute.pm index 5f29df1..fdcc5ce 100644 --- a/lib/MooseX/Getopt/Meta/Attribute.pm +++ b/lib/MooseX/Getopt/Meta/Attribute.pm @@ -1,5 +1,5 @@ -package MooseX::Getopt::Meta::Attribute; +package ; use Moose; use Moose::Util::TypeConstraints; @@ -18,9 +18,10 @@ has 'cmd_flag' => ( # without polluting the built-in types subtype '_MooseX_Getopt_CmdAliases' => as 'ArrayRef' - => where { 1 }; + => where { 1 }; + coerce '_MooseX_Getopt_CmdAliases' - => from 'Value' + => from 'Str' => via { [$_] }; has 'cmd_aliases' => ( @@ -125,6 +126,8 @@ to cpan-RT. Stevan Little Estevan@iinteractive.comE +Brandon L. Black, Eblblack@gmail.comE + =head1 COPYRIGHT AND LICENSE Copyright 2007 by Infinity Interactive, Inc.