r37112 - in /branches/upstream/libmoosex-app-cmd-perl: ./ current/ current/lib/ current/lib/MooseX/ current/lib/MooseX/App/ current/lib/MooseX/App/Cmd/ current/t/ current/t/lib/ current/t/lib/Test/ current/t/lib/Test/ConfigFromFile/ current/t/lib/Test/ConfigFromFile/Command/ current/t/lib/Test/MyCmd/ current/t/lib/Test/MyCmd/Command/

franck-guest at users.alioth.debian.org franck-guest at users.alioth.debian.org
Mon Jun 1 08:47:26 UTC 2009


Author: franck-guest
Date: Mon Jun  1 08:47:21 2009
New Revision: 37112

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37112
Log:
[svn-inject] Installing original source of libmoosex-app-cmd-perl

Added:
    branches/upstream/libmoosex-app-cmd-perl/
    branches/upstream/libmoosex-app-cmd-perl/current/
    branches/upstream/libmoosex-app-cmd-perl/current/Changes
    branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST
    branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST.SKIP
    branches/upstream/libmoosex-app-cmd-perl/current/META.yml
    branches/upstream/libmoosex-app-cmd-perl/current/Makefile.PL
    branches/upstream/libmoosex-app-cmd-perl/current/lib/
    branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/
    branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/
    branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd/
    branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd.pm
    branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd/Command.pm
    branches/upstream/libmoosex-app-cmd-perl/current/t/
    branches/upstream/libmoosex-app-cmd-perl/current/t/00-load.t
    branches/upstream/libmoosex-app-cmd-perl/current/t/basic.t
    branches/upstream/libmoosex-app-cmd-perl/current/t/build_emulates_new.t
    branches/upstream/libmoosex-app-cmd-perl/current/t/configfile.t
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile.pm
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/Command/
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/Command/moo.pm
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/config.yaml
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd.pm
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/bark.pm
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm
    branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/stock.pm

Added: branches/upstream/libmoosex-app-cmd-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/Changes?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/Changes (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/Changes Mon Jun  1 08:47:21 2009
@@ -1,0 +1,14 @@
+0.04
+    - Fix failing test when no Test::Output is available.
+      No code change (lestrrat)
+
+0.03
+    - EMulate App::Cmd's new + tests (groditi)
+    - Fix for newest MX::Getopt (dann)
+    - Add the ability to handle --configfile when used with MX::ConfigFromFile (lestrrat)
+
+0.02
+    - Use MooseX::Getopt 0.09's Getopt::Long::Descriptive features
+
+0.01
+    - Initial version

Added: branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST Mon Jun  1 08:47:21 2009
@@ -1,0 +1,19 @@
+Changes
+lib/MooseX/App/Cmd.pm
+lib/MooseX/App/Cmd/Command.pm
+Makefile.PL
+MANIFEST			This list of files
+MANIFEST.SKIP
+t/00-load.t
+t/basic.t
+t/build_emulates_new.t
+t/configfile.t
+t/lib/Test/ConfigFromFile.pm
+t/lib/Test/ConfigFromFile/Command/moo.pm
+t/lib/Test/ConfigFromFile/config.yaml
+t/lib/Test/MyCmd.pm
+t/lib/Test/MyCmd/Command/bark.pm
+t/lib/Test/MyCmd/Command/frobulate.pm
+t/lib/Test/MyCmd/Command/justusage.pm
+t/lib/Test/MyCmd/Command/stock.pm
+META.yml                                 Module meta-data (added by MakeMaker)

Added: branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST.SKIP?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/MANIFEST.SKIP Mon Jun  1 08:47:21 2009
@@ -1,0 +1,44 @@
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\B\.git\b
+\b_darcs\b
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$         # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+
+# Avoid Devel::Cover files.
+\bcover_db\b
+
+### DEFAULT MANIFEST.SKIP ENDS HERE ####
+
+\.DS_Store$
+\.sw.$
+(\w+-)*(\w+)-\d\.\d+(?:\.tar\.gz)?$
+
+\.t\.log$
+
+\.prove$
+
+# XS shit
+\.(?:bs|c|o)$

Added: branches/upstream/libmoosex-app-cmd-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/META.yml?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/META.yml (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/META.yml Mon Jun  1 08:47:21 2009
@@ -1,0 +1,17 @@
+--- #YAML:1.0
+name:                MooseX-App-Cmd
+version:             0.04
+abstract:            ~
+license:             ~
+author:              ~
+generated_by:        ExtUtils::MakeMaker version 6.44
+distribution_type:   module
+requires:     
+    App::Cmd:                      0
+    Getopt::Long::Descriptive:     0
+    Moose:                         0
+    MooseX::Getopt:                0.09
+    Test::use::ok:                 0
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Added: branches/upstream/libmoosex-app-cmd-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/Makefile.PL?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/Makefile.PL (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/Makefile.PL Mon Jun  1 08:47:21 2009
@@ -1,0 +1,21 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+	NAME         => 'MooseX::App::Cmd',
+	VERSION_FROM => 'lib/MooseX/App/Cmd.pm',
+	INSTALLDIRS  => 'site',
+#	SIGN         => 1, # temporary for now
+	PL_FILES     => { },
+	PREREQ_PM    => {
+		'Test::use::ok'             => 0,
+        'App::Cmd'                  => 0,
+        'Moose'                     => 0,
+        'MooseX::Getopt'            => "0.09",
+        'Getopt::Long::Descriptive' => 0,
+	},
+);
+

Added: branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,109 @@
+#!/usr/bin/perl
+
+package MooseX::App::Cmd;
+use File::Basename ();
+use Moose;
+
+extends qw(Moose::Object App::Cmd);
+
+sub BUILDARGS {
+  my $class = shift;
+  return {} unless @_;
+  return { arg => $_[0] } if @_ == 1;;
+  return { @_ };
+}
+
+sub BUILD {
+  my ($self,$args) = @_;
+
+  my $class = blessed $self;
+  my $arg0 = $0;
+  $self->{arg0}      = File::Basename::basename($arg0);
+  $self->{command}   = $class->_command( {}  );
+  $self->{full_arg0} = $arg0;
+}
+
+our $VERSION = "0.04";
+
+__PACKAGE__;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::App::Cmd - Mashes up L<MooseX::Getopt> and L<App::Cmd>.
+
+=head1 SYNOPSIS
+
+See L<App::Cmd/SYNOPSIS>.
+
+    package YourApp::Cmd;
+	use Moose;
+
+    extends qw(MooseX::App::Cmd);
+
+
+
+    package YourApp::Cmd::Command::blort;
+    use Moose;
+
+    extends qw(MooseX::App::Cmd::Command);
+
+    has blortex => (
+        isa => "Bool",
+        is  => "rw",
+        cmd_aliases   => "X",
+        documentation => "use the blortext algorithm",
+    );
+
+    has recheck => (
+        isa => "Bool",
+        is  => "rw",
+        cmd_aliases => "r",
+        documentation => "recheck all results",
+    );
+
+    sub run {
+        my ( $self, $opt, $args ) = @_;
+
+        # you may ignore $opt, it's in the attributes anyway
+        
+        my $result = $self->blortex ? blortex() : blort();
+
+        recheck($result) if $self->recheck;
+
+        print $result;
+    } 
+
+=head1 DESCRIPTION
+
+This module marries L<App::Cmd> with L<MooseX::Getopt>.
+
+Use it like L<App::Cmd> advises (especially see L<App::Cmd::Tutorial>),
+swapping L<App::Cmd::Command> for L<MooseX::App::Cmd::Command>.
+
+Then you can write your moose commands as moose classes, with L<MooseX::Getopt>
+defining the options for you instead of C<opt_spec> returning a
+L<Getopt::Long::Descriptive> spec.
+
+=head1 AUTHOR
+
+Yuval Kogman E<lt>nothingmuch at woobling.orgE<gt>
+
+With contributions from:
+
+=over 4
+
+=item Guillermo Roditi E<lt>groditi at cpan.orgE<gt>
+
+=back
+
+=head1 COPYRIGHT
+
+    Copyright (c) 2007-2008 Infinity Interactive, Yuval Kogman. All rights
+    reserved This program is free software; you can redistribute it and/or
+    modify it under the same terms as Perl itself.
+
+=cut

Added: branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd/Command.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd/Command.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd/Command.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/lib/MooseX/App/Cmd/Command.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,126 @@
+#!/usr/bin/perl
+
+package MooseX::App::Cmd::Command;
+use Moose;
+
+with qw/MooseX::Getopt/;
+
+extends qw(Moose::Object App::Cmd::Command);
+
+with qw(MooseX::Getopt);
+
+use Getopt::Long::Descriptive ();
+
+has usage => (
+    metaclass => "NoGetopt",
+    isa => "Object",
+    is  => "ro",
+    required => 1,
+);
+
+has app => (
+    metaclass => "NoGetopt",
+    isa => "MooseX::App::Cmd",
+    is  => "ro",
+    required => 1,
+);
+
+sub _process_args {
+    my ( $class, $args, @params ) = @_;
+
+    my $config_from_file;
+    if($class->meta->does_role('MooseX::ConfigFromFile')) {
+        local @ARGV = @ARGV;
+
+        my $configfile;
+        my $opt_parser = Getopt::Long::Parser->new( config => [ qw( pass_through
+ ) ] );
+        $opt_parser->getoptions( "configfile=s" => \$configfile );        if(!defined $configfile) {
+            my $cfmeta = $class->meta->find_attribute_by_name('configfile');
+            $configfile = $cfmeta->default if $cfmeta->has_default;
+        }
+
+        if(defined $configfile) {
+            $config_from_file = $class->get_config_from_file($configfile);
+        }
+    }
+
+    my %processed = $class->_parse_argv(
+        argv => $args,
+        options => [ $class->_attrs_to_options( $config_from_file ) ],
+    );
+
+    return (
+        $processed{params},
+        $processed{argv},
+        usage => $processed{usage},
+        # params from CLI are also fields in MooseX::Getopt
+        %{ $config_from_file ?
+            { %$config_from_file, %{$processed{params}} } :
+            $processed{params} },
+    );
+}
+
+sub _usage_format {
+    my $class = shift;
+    $class->usage_desc();
+}
+
+__PACKAGE__;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+MooseX::App::Cmd::Command - Base class for L<MooseX::Getopt> based L<App::Cmd::Command>s.
+
+=head1 SYNOPSIS
+
+    use Moose;
+
+    extends qw(MooseX::App::Cmd::Command);
+
+    # no need to set opt_spec
+    # see MooseX::Getopt for documentation on how to specify options
+    has option_field => (
+        isa => "Str",
+        is  => "rw",
+        required => 1,
+    );
+
+    sub run {
+        my ( $self, $opts, $args ) = @_;
+
+        print $self->option_field; # also available in $opts->{option_field}
+    }
+
+=head1 DESCRIPTION
+
+This is a replacement base class for L<App::Cmd::Command> classes that includes
+L<MooseX::Getopt> and the glue to combine the two.
+
+=head1 METHODS
+
+=over 4
+
+=item _process_args
+
+Replaces L<App::Cmd::Command>'s argument processing in in favour of
+L<MooseX::Getopt> based processing.
+
+=back
+
+=head1 TODO
+
+Full support for L<Getopt::Long::Descriptive>'s abilities is not yet written.
+
+This entails taking apart the attributes and getting at the descriptions.
+
+This might actually be added upstream to L<MooseX::Getopt>, so until we decide
+here's a functional but not very helpful (to the user) version anyway.
+
+=cut
+
+

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/00-load.t?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/00-load.t (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/00-load.t Mon Jun  1 08:47:21 2009
@@ -1,0 +1,7 @@
+#!perl -T
+
+use Test::More tests => 2;
+
+use ok 'MooseX::App::Cmd';
+use ok 'MooseX::App::Cmd::Command';
+

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/basic.t?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/basic.t (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/basic.t Mon Jun  1 08:47:21 2009
@@ -1,0 +1,92 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 12;
+
+use lib 't/lib';
+
+use Test::MyCmd;
+
+my $cmd = Test::MyCmd->new;
+
+isa_ok($cmd, 'Test::MyCmd');
+
+is_deeply(
+  [ sort $cmd->command_names ],
+  [ sort qw(help --help -h -? commands frob frobulate justusage stock bark) ],
+  "got correct list of registered command names",
+);
+
+use Data::Dumper;
+Dumper $cmd->command_plugins;
+is_deeply(
+  [ sort $cmd->command_plugins ],
+  [ qw(
+    App::Cmd::Command::commands
+    App::Cmd::Command::help
+    Test::MyCmd::Command::bark
+    Test::MyCmd::Command::frobulate
+    Test::MyCmd::Command::justusage
+    Test::MyCmd::Command::stock
+  ) ],
+  "got correct list of registered command plugins",
+);
+
+{
+  local @ARGV = qw(frob --widget wname your fat face);
+  eval { $cmd->run };
+  
+  is(
+    $@,
+    "the widget name is wname - your fat face\n",
+    "command died with the correct string",
+  );
+}
+
+{
+  local $TODO = "usage not yet supported";
+  local @ARGV = qw(justusage);
+  eval { $cmd->run };
+
+  my $error = $@;
+  
+  like(
+    $error,
+    qr/^basic.t justusage/,
+    "default usage_desc is okay",
+  );
+}
+
+{
+  local @ARGV = qw(stock);
+  eval { $cmd->run };
+  
+  like($@, qr/mandatory method/, "un-subclassed &run leads to death");
+}
+
+{
+  local @ARGV = qw(bark);
+  eval { $cmd->run };
+  
+  like(
+    $@,
+    qr/Required option missing: wow/, 
+    "required option fileld is missing",
+  );
+}
+
+SKIP: {
+  my $have_TO = eval { require Test::Output; 1; };
+  print STDERR $@;
+  skip "these tests require Test::Output", 5 unless $have_TO;
+
+  local @ARGV = qw(commands);
+
+  my ($output) = Test::Output::output_from(sub { $cmd->run });
+
+  for my $name (qw(commands frobulate justusage stock bark)) {
+    like($output, qr/^\s+\Q$name\E/sm, "$name plugin in listing");
+  }
+}

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/build_emulates_new.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/build_emulates_new.t?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/build_emulates_new.t (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/build_emulates_new.t Mon Jun  1 08:47:21 2009
@@ -1,0 +1,18 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+{
+
+  package Foo;
+  use base 'App::Cmd';
+
+  package Bar;
+  use Moose;
+  extends 'MooseX::App::Cmd';
+
+}
+
+is_deeply(\%{ Bar->new }, \%{ Foo->new }, 'Internal hashes match');

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/configfile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/configfile.t?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/configfile.t (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/configfile.t Mon Jun  1 08:47:21 2009
@@ -1,0 +1,45 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN
+{
+    eval {
+        require MooseX::ConfigFromFile;
+        require YAML;
+    };
+    if ($@) {
+        plan( skip_all => "These tests require MooseX::ConfigFromFile and YAML" );
+    } else {
+        plan( tests => 2 );
+    }
+}
+
+use lib 't/lib';
+use Test::ConfigFromFile;
+
+my $cmd = Test::ConfigFromFile->new;
+
+{
+  local @ARGV = qw(moo);
+  eval { $cmd->run };
+  
+  like(
+    $@,
+    qr/Required option missing/,
+    "command died with the correct string",
+  );
+}
+
+{
+  local @ARGV = qw(moo --configfile=t/lib/Test/ConfigFromFile/config.yaml);
+  eval { $cmd->run };
+  
+  like(
+    $@,
+    qr/cows go moo1 moo2 moo3/,
+    "command died with the correct string",
+  );
+}

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,6 @@
+package Test::ConfigFromFile;
+use Moose;
+
+extends qw(MooseX::App::Cmd);
+
+1;

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/Command/moo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/Command/moo.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/Command/moo.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/Command/moo.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,34 @@
+package Test::ConfigFromFile::Command::moo;
+use Moose;
+use YAML();
+
+extends qw(MooseX::App::Cmd::Command);
+with 'MooseX::ConfigFromFile';
+
+=head1 NAME
+
+Test::MyCmd::Command::moo - reads from config file
+
+=cut
+
+has 'moo' => (
+    isa => "ArrayRef",
+    is  => "ro",
+    required => 1,
+    auto_deref => 1,
+    documentation => "required option field",
+);
+
+sub run {
+  my ($self, $opt, $arg) =@_;
+
+  die ("cows go " . join(' ', $self->moo));
+}
+
+sub get_config_from_file {
+    my ($self, $file) = @_;
+
+    return YAML::LoadFile($file);
+}
+
+1;

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/config.yaml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/config.yaml?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/config.yaml (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/ConfigFromFile/config.yaml Mon Jun  1 08:47:21 2009
@@ -1,0 +1,4 @@
+moo:
+    - moo1
+    - moo2
+    - moo3

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,6 @@
+package Test::MyCmd;
+use Moose;
+
+extends qw(MooseX::App::Cmd);
+
+1;

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/bark.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/bark.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/bark.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/bark.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,25 @@
+package Test::MyCmd::Command::bark;
+use Moose;
+
+extends qw(MooseX::App::Cmd::Command);
+
+=head1 NAME
+
+Test::MyCmd::Command::bark - required field is used
+
+=cut
+
+has wow => (
+    isa => "Str",
+    is  => "ro",
+    required => 1,
+    documentation => "required option field",
+);
+
+sub run {
+  my ($self, $opt, $arg) =@_;
+
+  die "my dog name barks " . $self->wow . "\n";
+}
+
+1;

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,29 @@
+package Test::MyCmd::Command::frobulate;
+use Moose;
+
+extends qw(MooseX::App::Cmd::Command);
+
+sub command_names {
+  return qw(frobulate frob);
+}
+
+has foo_bar => (
+    isa => "Bool",
+    is  => "ro",
+    cmd_aliases => "F",
+    documentation => "enable foo-bar subsystem",
+);
+
+has widget => (
+    isa => "Str",
+    is  => "ro",
+    documentation => "set widget name",
+);
+
+sub run {
+  my ($self, $opt, $arg) =@_;
+
+  die "the widget name is " . $self->widget . " - @$arg\n";
+}
+
+1;

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,18 @@
+package Test::MyCmd::Command::justusage;
+use Moose;
+
+extends qw(MooseX::App::Cmd::Command);
+
+=head1 NAME
+
+Test::MyCmd::Command::justusage - it just dies its own usage, no matter what
+
+=cut
+
+sub run {
+  my ($self, $opt, $arg) = @_;
+
+  die $self->usage->text;
+}
+
+1;

Added: branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/stock.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/stock.pm?rev=37112&op=file
==============================================================================
--- branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/stock.pm (added)
+++ branches/upstream/libmoosex-app-cmd-perl/current/t/lib/Test/MyCmd/Command/stock.pm Mon Jun  1 08:47:21 2009
@@ -1,0 +1,14 @@
+package Test::MyCmd::Command::stock;
+use Moose;
+
+extends qw(MooseX::App::Cmd::Command);
+
+=head1 NAME
+
+Test::MyCmd::Command::stock - nothing here is overridden
+
+=cut
+
+# This package exists to test all the default command plugin behaviors.
+
+1;




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