r32971 - in /branches/upstream/libmoosex-getopt-perl/current: ./ lib/MooseX/ lib/MooseX/Getopt/ lib/MooseX/Getopt/Meta/ lib/MooseX/Getopt/Meta/Attribute/ lib/MooseX/Getopt/Meta/Attribute/Trait/ t/

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Fri Apr 10 00:47:23 UTC 2009


Author: ryan52-guest
Date: Fri Apr 10 00:47:18 2009
New Revision: 32971

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32971
Log:
[svn-upgrade] Integrating new upstream version, libmoosex-getopt-perl (0.18)

Added:
    branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Dashes.pm
    branches/upstream/libmoosex-getopt-perl/current/t/010_dashes.t
Modified:
    branches/upstream/libmoosex-getopt-perl/current/ChangeLog
    branches/upstream/libmoosex-getopt-perl/current/MANIFEST
    branches/upstream/libmoosex-getopt-perl/current/META.yml
    branches/upstream/libmoosex-getopt-perl/current/README
    branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt.pm
    branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute.pm
    branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm
    branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait.pm
    branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm
    branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/OptionTypeMap.pm

Modified: branches/upstream/libmoosex-getopt-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/ChangeLog?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/ChangeLog (original)
+++ branches/upstream/libmoosex-getopt-perl/current/ChangeLog Fri Apr 10 00:47:18 2009
@@ -1,4 +1,8 @@
 Revision history for Perl extension MooseX-Getopt
+
+0.18 Thu. April 9 2009
+	* MooseX::Getopt::Dashes
+		- New module, for converting undercores to dashes (ilmari)
 
 0.17 Wed. April 8 2009
   * MooseX::Getopt

Modified: branches/upstream/libmoosex-getopt-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/MANIFEST?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/MANIFEST (original)
+++ branches/upstream/libmoosex-getopt-perl/current/MANIFEST Fri Apr 10 00:47:18 2009
@@ -11,6 +11,7 @@
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 lib/MooseX/Getopt.pm
+lib/MooseX/Getopt/Dashes.pm
 lib/MooseX/Getopt/Meta/Attribute.pm
 lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm
 lib/MooseX/Getopt/Meta/Attribute/Trait.pm
@@ -31,6 +32,7 @@
 t/007_nogetopt_trait.t
 t/008_configfromfile.t
 t/009_gld_and_explicit_options.t
+t/010_dashes.t
 t/100_gld_default_bug.t
 t/pod.t
 t/pod_coverage.t

Modified: branches/upstream/libmoosex-getopt-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/META.yml?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/META.yml (original)
+++ branches/upstream/libmoosex-getopt-perl/current/META.yml Fri Apr 10 00:47:18 2009
@@ -22,4 +22,4 @@
   Moose: 0.56
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.17
+version: 0.18

Modified: branches/upstream/libmoosex-getopt-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/README?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/README (original)
+++ branches/upstream/libmoosex-getopt-perl/current/README Fri Apr 10 00:47:18 2009
@@ -1,4 +1,4 @@
-MooseX::Getopt version 0.17
+MooseX::Getopt version 0.18
 ===========================
 
 See the individual module documentation for more information

Modified: branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt.pm?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt.pm (original)
+++ branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt.pm Fri Apr 10 00:47:18 2009
@@ -11,7 +11,7 @@
 use Getopt::Long (); # GLD uses it anyway, doesn't hurt
 use constant HAVE_GLD => not not eval { require Getopt::Long::Descriptive };
 
-our $VERSION   = '0.17';
+our $VERSION   = '0.18';
 our $AUTHORITY = 'cpan:STEVAN';
 
 has ARGV       => (is => 'rw', isa => 'ArrayRef', metaclass => "NoGetopt");

Added: branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Dashes.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Dashes.pm?rev=32971&op=file
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Dashes.pm (added)
+++ branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Dashes.pm Fri Apr 10 00:47:18 2009
@@ -1,0 +1,72 @@
+package MooseX::Getopt::Dashes;
+use Moose::Role;
+
+with 'MooseX::Getopt';
+
+around _get_cmd_flags_for_attr => sub {
+    my $next = shift;
+    my ( $class, $attr, @rest ) = @_;
+
+    my ( $flag, @aliases ) = $class->$next($attr, @rest);
+    $flag =~ tr/_/-/
+        unless $attr->does('MooseX::Getopt::Meta::Attribute::Trait')
+            && $attr->has_cmd_flag;
+
+    return ( $flag, @aliases );
+};
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::Getopt::Dashes - convert underscores in attribute names to dashes
+
+=head1 SYNOPSIS
+
+  package My::App;
+  use Moose;
+  with 'MooseX::Getopt::Dashes';
+
+  # use as MooseX::Getopt
+
+=head1 DESCRIPTION
+
+This is a version of C<MooseX::Getopt> which converts underscores in
+attribute names to dashes when generating command line flags.
+
+=head1 METHODS
+
+=over 4
+
+=item meta
+
+=back
+
+=head1 BUGS
+
+All complex software has bugs lurking in it, and this module is no
+exception. If you find a bug please either email me, or add the bug
+to cpan-RT.
+
+=head1 AUTHOR
+
+Dagfinn Ilmari MannsE<aring>ker E<lt>ilmari at ilmari.orgE<gt>
+
+Stevan Little E<lt>stevan at iinteractive.comE<gt>
+
+Yuval Kogman  C<< <nuffin at cpan.org> >>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2007-2008 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut

Modified: branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute.pm?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute.pm (original)
+++ branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute.pm Fri Apr 10 00:47:18 2009
@@ -3,7 +3,7 @@
 use Moose;
 use Moose::Util::TypeConstraints;
 
-our $VERSION   = '0.17';
+our $VERSION   = '0.18';
 our $AUTHORITY = 'cpan:STEVAN';
 
 extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)

Modified: branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm (original)
+++ branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm Fri Apr 10 00:47:18 2009
@@ -2,7 +2,7 @@
 package MooseX::Getopt::Meta::Attribute::NoGetopt;
 use Moose;
 
-our $VERSION   = '0.17';
+our $VERSION   = '0.18';
 our $AUTHORITY = 'cpan:STEVAN';
 
 extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)

Modified: branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait.pm?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait.pm (original)
+++ branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait.pm Fri Apr 10 00:47:18 2009
@@ -3,7 +3,7 @@
 use Moose::Role;
 use Moose::Util::TypeConstraints;
 
-our $VERSION   = '0.17';
+our $VERSION   = '0.18';
 our $AUTHORITY = 'cpan:STEVAN';
 
 has 'cmd_flag' => (

Modified: branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm (original)
+++ branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm Fri Apr 10 00:47:18 2009
@@ -2,7 +2,7 @@
 package MooseX::Getopt::Meta::Attribute::Trait::NoGetopt;
 use Moose::Role;
 
-our $VERSION   = '0.17';
+our $VERSION   = '0.18';
 our $AUTHORITY = 'cpan:STEVAN';
 
 no Moose::Role;

Modified: branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/OptionTypeMap.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/OptionTypeMap.pm?rev=32971&op=diff
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/OptionTypeMap.pm (original)
+++ branches/upstream/libmoosex-getopt-perl/current/lib/MooseX/Getopt/OptionTypeMap.pm Fri Apr 10 00:47:18 2009
@@ -4,7 +4,7 @@
 use Moose 'confess', 'blessed';
 use Moose::Util::TypeConstraints 'find_type_constraint';
 
-our $VERSION   = '0.17';
+our $VERSION   = '0.18';
 our $AUTHORITY = 'cpan:STEVAN';
 
 my %option_type_map = (

Added: branches/upstream/libmoosex-getopt-perl/current/t/010_dashes.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-getopt-perl/current/t/010_dashes.t?rev=32971&op=file
==============================================================================
--- branches/upstream/libmoosex-getopt-perl/current/t/010_dashes.t (added)
+++ branches/upstream/libmoosex-getopt-perl/current/t/010_dashes.t Fri Apr 10 00:47:18 2009
@@ -1,0 +1,32 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use Test::Exception;
+
+
+BEGIN {
+	use_ok('MooseX::Getopt');
+}
+
+{
+	package App;
+	use Moose;
+
+	with 'MooseX::Getopt::Dashes';
+
+	has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' );
+}
+
+{
+	local @ARGV = (qw/--some-thingy bar/);
+    lives_and { is( App->new_with_options->some_thingy, 'bar') } 'Dash in option name';
+}
+
+{
+    local @ARGV = (qw/--some_thingy bar/);
+    throws_ok { App->new_with_options } qr/Unknown option: some_thingy/;
+}




More information about the Pkg-perl-cvs-commits mailing list