r43210 - in /branches/upstream/libapp-cmd-perl/current: ./ lib/App/ lib/App/Cmd/ lib/App/Cmd/Command/ lib/App/Cmd/Subdispatch/ t/lib/Test/ t/lib/Test/MyCmd/Command/ t/lib/Test/WSNCC/Command/ t/lib/Test/WithSetup/Command/

carnil-guest at users.alioth.debian.org carnil-guest at users.alioth.debian.org
Sat Aug 29 05:26:41 UTC 2009


Author: carnil-guest
Date: Sat Aug 29 05:26:31 2009
New Revision: 43210

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=43210
Log:
[svn-upgrade] Integrating new upstream version, libapp-cmd-perl (0.300)

Modified:
    branches/upstream/libapp-cmd-perl/current/Changes
    branches/upstream/libapp-cmd-perl/current/META.yml
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/ArgProcessor.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/commands.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/help.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Simple.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch/DashedStyle.pm
    branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Tutorial.pod
    branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm
    branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm
    branches/upstream/libapp-cmd-perl/current/t/lib/Test/MySimple.pm
    branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSNCC/Command/blort.pm
    branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSOF.pm
    branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/alfie.pm
    branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/bertie.pm

Modified: branches/upstream/libapp-cmd-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/Changes?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/Changes (original)
+++ branches/upstream/libapp-cmd-perl/current/Changes Sat Aug 29 05:26:31 2009
@@ -1,4 +1,19 @@
 Revision history for App-Cmd
+
+0.300     2009-09-28
+          DEPRECATED -run OPTION TO APP CLASS IMPORT
+          "use MyApp -run;" is deprecated; it will be removed after no less
+          than a year
+
+          this led to problems where normal exit-on-error messages confused
+          users by complaining about failing to compile; magic to stop this is
+          not worth the tiny savings
+
+          COMMANDS SHOULD NOW HAVE ->execute RATHER THAN ->run
+          this will not break you code... except:
+
+          WILL BREAK YOUR CODE: App::Cmd::Simple programs must use ->execute
+          rather than ->run
 
 0.207     2009-09-27
           add option to allow any unambiguous command abbreviation

Modified: branches/upstream/libapp-cmd-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/META.yml?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/META.yml (original)
+++ branches/upstream/libapp-cmd-perl/current/META.yml Sat Aug 29 05:26:31 2009
@@ -29,4 +29,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: http://github.com/rjbs/app-cmd
-version: 0.207
+version: 0.300

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd.pm Sat Aug 29 05:26:31 2009
@@ -13,7 +13,10 @@
 use Sub::Exporter -setup => {
   collectors => {
     -command => \'_setup_command',
-    -run     => sub { $_[1]->{class}->run; 1 },
+    -run     => sub {
+      warn "using -run to run your command is deprecated\n";
+      $_[1]->{class}->run; 1
+    },
   },
 };
 
@@ -48,11 +51,11 @@
 
 =head1 VERSION
 
-version 0.207
-
-=cut
-
-our $VERSION = '0.207';
+version 0.300
+
+=cut
+
+our $VERSION = '0.300';
 
 =head1 SYNOPSIS
 
@@ -369,7 +372,7 @@
   local our $active_cmd = $cmd;
 
   $cmd->validate_args($opt, \@args);
-  $cmd->run($opt, \@args);
+  $cmd->execute($opt, \@args);
 }
 
 =head2 plugin_search_path

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/ArgProcessor.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/ArgProcessor.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/ArgProcessor.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/ArgProcessor.pm Sat Aug 29 05:26:31 2009
@@ -9,11 +9,11 @@
 
 =head1 VERSION
 
-version 0.207
+version 0.300
 
 =cut
 
-our $VERSION = '0.207';
+our $VERSION = '0.300';
 
 sub _process_args {
   my ($class, $args, @params) = @_;

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command.pm Sat Aug 29 05:26:31 2009
@@ -11,11 +11,11 @@
 
 =head1 VERSION
 
-version 0.207
-
-=cut
-
-our $VERSION = '0.207';
+version 0.300
+
+=cut
+
+our $VERSION = '0.300';
 
 use Carp ();
 
@@ -69,19 +69,32 @@
   bless $arg => $class;
 }
 
-=head2 run
-
-  $command_plugin->run(\%opt, \@args);
+=head2 execute
+
+=for Pod::Coverage run
+
+  $command_plugin->execute(\%opt, \@args);
 
 This method does whatever it is the command should do!  It is passed a hash
 reference of the parsed command-line options and an array reference of left
 over arguments.
 
-=cut
-
-sub run {
-  my ($class) = @_;
-  Carp::croak "$class does not implement mandatory method 'run'\n";
+If no C<execute> method is defined, it will try to call C<run> -- but it will
+warn about this behavior during testing, to remind you to fix the method name!
+
+=cut
+
+sub execute {
+  my $class = shift;
+
+  if (my $run = $class->can('run')) {
+    warn "App::Cmd::Command subclasses should implement ->execute not ->run"
+      if $ENV{HARNESS_ACTIVE};
+
+    return $class->$run(@_);
+  }
+
+  Carp::croak "$class does not implement mandatory method 'execute'\n";
 }
 
 =head2 app

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/commands.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/commands.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/commands.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/commands.pm Sat Aug 29 05:26:31 2009
@@ -11,11 +11,11 @@
 
 =head1 VERSION
 
-version 0.207
+version 0.300
 
 =cut
 
-our $VERSION = 0.207;
+our $VERSION = 0.300;
 
 =head1 DESCRIPTION
 
@@ -24,7 +24,7 @@
 
 =head1 METHODS
 
-=head2 C<run>
+=head2 execute
 
 This is the command's primary method and raison d'etre.  It prints the
 application's usage text (if any) followed by a sorted listing of the
@@ -35,7 +35,7 @@
 
 =cut
 
-sub run {
+sub execute {
   my ($self) = @_;
 
   local $@;

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/help.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/help.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/help.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Command/help.pm Sat Aug 29 05:26:31 2009
@@ -11,11 +11,11 @@
 
 =head1 VERSION
 
-version 0.207
+version 0.300
 
 =cut
 
-our $VERSION = '0.207';
+our $VERSION = '0.300';
 
 =head1 DESCRIPTION
 

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Simple.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Simple.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Simple.pm Sat Aug 29 05:26:31 2009
@@ -5,7 +5,7 @@
 use App::Cmd::Command;
 BEGIN { our @ISA = 'App::Cmd::Command' }
 
-our $VERSION = '0.207';
+our $VERSION = '0.300';
 
 use App::Cmd;
 use Sub::Install;
@@ -105,8 +105,14 @@
   # This signals that something has already set the target up.
   return $class if $class->_cmd_pkg;
 
+  my $core_execute = App::Cmd::Command->can('execute');
+  my $our_execute  = $class->can('execute');
+  Carp::confess(
+    "App::Cmd::Simple subclasses must implement ->execute, not ->run"
+  ) unless $our_execute and $our_execute != $core_execute;
+
   # I doubt the $i will ever be needed, but let's start paranoid.
-  my $generated_name = join('::', $class, 'Cmd', $i++);
+  my $generated_name = join('::', $class, '_App_Cmd', $i++);
 
   {
     no strict 'refs';
@@ -117,12 +123,6 @@
     into => $class,
     as   => '_cmd_pkg',
     code => sub { $generated_name },
-  });
-
-  Sub::Install::reinstall_sub({
-    into => $class,
-    as   => "__$i", # cheap trick -- rjbs, 2007-10-09
-    code => $class->can('run'),
   });
 
   Sub::Install::install_sub({
@@ -147,19 +147,16 @@
     },
   });
 
-  # required to make compilation packages correct for caller
-  eval qq[
-    no warnings 'redefine';
-    package $class;
-    sub run {
-      my \$caller = caller;
-      return shift->__$i(\@_) if \$caller eq 'App::Cmd';
-      return ${generated_name}->new({
+  Sub::Install::install_sub({
+    into => $class,
+    as   => 'run',
+    code => sub {
+      $generated_name->new({
         no_help_plugin     => 1,
         no_commands_plugin => 1,
-      })->run(\@_);
+      })->run(@_);
     }
-  ];
+  });
 
   return $class;
 }

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch.pm Sat Aug 29 05:26:31 2009
@@ -13,11 +13,11 @@
 
 =head1 VERSION
 
-version 0.207
+version 0.300
 
 =cut
 
-our $VERSION = '0.207';
+our $VERSION = '0.300';
 
 =head1 METHODS
 

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch/DashedStyle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch/DashedStyle.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch/DashedStyle.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Subdispatch/DashedStyle.pm Sat Aug 29 05:26:31 2009
@@ -11,11 +11,11 @@
 
 =head1 VERSION
 
-version 0.207
+version 0.300
 
 =cut
 
-our $VERSION = '0.207';
+our $VERSION = '0.300';
 
 =head1 METHODS
 

Modified: branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Tutorial.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Tutorial.pod?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Tutorial.pod (original)
+++ branches/upstream/libapp-cmd-perl/current/lib/App/Cmd/Tutorial.pod Sat Aug 29 05:26:31 2009
@@ -17,7 +17,8 @@
 generally consist of just a few lines:
 
   #!/usr/bin/perl
-  use YourApp -run;
+  use YourApp;
+  YourApp->run;
 
 All the work of argument parsing, validation, and dispatch is taken care of by
 your application class.  The application class can also be pretty simple, and
@@ -52,9 +53,9 @@
   YourApp::Command::initialize does not implement mandatory method 'run'
 
 Oops!  This dies because we haven't told the command class what it should do
-when run.  This is easy, we just add some code:
+when executed.  This is easy, we just add some code:
 
-  sub run {
+  sub execute {
     my ($self, $opt, $args) = @_;
 
     print "Everything has been initialized.  (Not really.)\n";

Modified: branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/frobulate.pm Sat Aug 29 05:26:31 2009
@@ -16,7 +16,7 @@
   );
 }
 
-sub run {
+sub execute {
   my ($self, $opt, $arg) =@_;
 
   die "the widget name is $opt->{widget} - @$arg\n";

Modified: branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/t/lib/Test/MyCmd/Command/justusage.pm Sat Aug 29 05:26:31 2009
@@ -11,7 +11,7 @@
 
 =cut
 
-sub run {
+sub execute {
   my ($self, $opt, $arg) = @_;
 
   die $self->usage->text;

Modified: branches/upstream/libapp-cmd-perl/current/t/lib/Test/MySimple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/t/lib/Test/MySimple.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/t/lib/Test/MySimple.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/t/lib/Test/MySimple.pm Sat Aug 29 05:26:31 2009
@@ -5,7 +5,7 @@
 
 use Data::Dumper;
 
-sub run {
+sub execute {
   my ($self, $opt, $args) = @_;
 
   local $Data::Dumper::Terse = 1;

Modified: branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSNCC/Command/blort.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSNCC/Command/blort.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSNCC/Command/blort.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSNCC/Command/blort.pm Sat Aug 29 05:26:31 2009
@@ -3,7 +3,7 @@
 package Test::WSNCC::Command::blort;
 use Test::WSNCC -command;
 
-sub run {
+sub execute {
   my ($self, $opt, $args) = @_;
   return $opt;
 }

Modified: branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSOF.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSOF.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSOF.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/t/lib/Test/WSOF.pm Sat Aug 29 05:26:31 2009
@@ -10,6 +10,6 @@
 package Test::WSOF::Command::poot;
 use Test::WSOF -command;
 
-sub run { return 'woof woof poot' }
+sub execute { return 'woof woof poot' }
 
 1;

Modified: branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/alfie.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/alfie.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/alfie.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/alfie.pm Sat Aug 29 05:26:31 2009
@@ -3,7 +3,7 @@
 package Test::WithSetup::Command::alfie;
 use Test::WithSetup -command;
 
-sub run {
+sub execute {
   my ($self, $opt, $args) = @_;
   return $opt;
 }

Modified: branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/bertie.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/bertie.pm?rev=43210&op=diff
==============================================================================
--- branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/bertie.pm (original)
+++ branches/upstream/libapp-cmd-perl/current/t/lib/Test/WithSetup/Command/bertie.pm Sat Aug 29 05:26:31 2009
@@ -3,7 +3,7 @@
 package Test::WithSetup::Command::bertie;
 use Test::WithSetup -command;
 
-sub run {
+sub execute {
   my ($self, $opt, $args) = @_;
   return xyzzy foo => 'bar';
 }




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