* 'master' of git@github.com:bobtfish/moosex-getopt:
Cleanup test, removing unneeded code serving no purpose or tested elsewhere
Enable the argv argument to the constructor.
Revision history for Perl extension MooseX-Getopt
+ * MooseX::Getopt
+ - Enable and document the argv parameter to the constructor.
+
0.20 Wed. July 9 2009
~ fix MANIFEST.SKIP to avoid double-packaging
sub _parse_argv {
my ( $class, %params ) = @_;
- local @ARGV = @{ $params{argv} || \@ARGV };
+ local @ARGV = @{ $params{params}{argv} || \@ARGV };
my ( $opt_spec, $name_to_init_arg ) = ( HAVE_GLD ? $class->_gld_spec(%params) : $class->_traditional_spec(%params) );
--- /dev/null
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use MooseX::Getopt;
+
+{
+ package App;
+ use Moose;
+
+ with 'MooseX::Getopt';
+
+ has 'length' => (
+ is => 'ro',
+ isa => 'Int',
+ default => 24,
+ );
+
+ has 'verbose' => (
+ is => 'ro',
+ isa => 'Bool',
+ default => 0,
+ );
+ no Moose;
+}
+
+{
+ my $app = App->new_with_options(argv => [ '--verbose', '--length', 50 ]);
+ isa_ok($app, 'App');
+
+ ok($app->verbose, '... verbosity is turned on as expected');
+ is($app->length, 50, '... length is 50 as expected');
+}
+