From: Piotr Roszatycki Date: Wed, 12 Nov 2008 21:49:01 +0000 (+0000) Subject: * MooseX::Getopt::Parser::*: fix regression: support attributes without type. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=05e8fe8973c9305d2a81ee513474cd5f78a0fef3;p=gitmo%2FMooseX-Getopt.git * MooseX::Getopt::Parser::*: fix regression: support attributes without type. * MooseX::Getopt::Parser::Long: use strcat_warning() for concatenating strings. --- diff --git a/lib/MooseX/Getopt/Parser/Descriptive.pm b/lib/MooseX/Getopt/Parser/Descriptive.pm index 4688df6..3e71d34 100644 --- a/lib/MooseX/Getopt/Parser/Descriptive.pm +++ b/lib/MooseX/Getopt/Parser/Descriptive.pm @@ -46,7 +46,7 @@ sub build_options { $cmd_flags_to_names{$flag} = $name; my $opt_string = join '|', $flag, @aliases; - $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type); + $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type) if $type; my $doc; $doc = $attr->documentation if $attr->has_documentation; diff --git a/lib/MooseX/Getopt/Parser/Long.pm b/lib/MooseX/Getopt/Parser/Long.pm index 12f6565..e7c5828 100644 --- a/lib/MooseX/Getopt/Parser/Long.pm +++ b/lib/MooseX/Getopt/Parser/Long.pm @@ -36,7 +36,7 @@ sub build_options { my $type = $getopt->_get_cmd_type_for_attr($attr); my $opt_string = join '|', $flag, @aliases; - $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type); + $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type) if $type; $options{$name} = undef; push @opts, $opt_string => \$options{$name}; @@ -53,9 +53,7 @@ sub build_options { local $SIG{__WARN__} = sub { return warn @_ if $_[0]=~/^\###/; # Smart::Comments - my $warning = $getopt->has_warning ? $getopt->warning : ''; - $warning .= $_[0]; - $getopt->warning( $warning ) + $getopt->strcat_warning( $_[0] ) }; my $status = $parser->getoptions( @opts );