[Bps-public-commit] r15497 - in sd/branches/dispatcher: lib/App/SD/CLI

sartak at bestpractical.com sartak at bestpractical.com
Tue Aug 26 13:42:10 EDT 2008


Author: sartak
Date: Tue Aug 26 13:42:09 2008
New Revision: 15497

Modified:
   sd/branches/dispatcher/   (props changed)
   sd/branches/dispatcher/lib/App/SD/CLI/Dispatcher.pm

Log:
 r70397 at onn:  sartak | 2008-08-26 13:42:00 -0400
 Use context in the dispatcher


Modified: sd/branches/dispatcher/lib/App/SD/CLI/Dispatcher.pm
==============================================================================
--- sd/branches/dispatcher/lib/App/SD/CLI/Dispatcher.pm	(original)
+++ sd/branches/dispatcher/lib/App/SD/CLI/Dispatcher.pm	Tue Aug 26 13:42:09 2008
@@ -5,13 +5,12 @@
 use Prophet::CLI::Dispatcher -base;
 
 on qr{^(ticket|comment|attachment) \s+ (.*)}xi => sub {
-    my $cli = shift;
-    $cli->set_arg(type => $1);
-    run($2, $cli, @_);
+    my %args = @_;
+    $args{context}->set_arg(type => $1);
+    run($2, %args);
 };
 
 on qr{.} => sub {
-    my $cli = shift;
     my %args = @_;
 
     my @pieces = map { ucfirst lc $_ } __PACKAGE__->resolve_builtin_aliases(@{ $args{dispatching_on} });
@@ -23,6 +22,8 @@
         shift @pieces;
     }
 
+    my $cli = $args{cli};
+
     for my $class (@possible_classes) {
         if ($cli->_try_to_load_cmd_class($class)) {
             return $args{got_command}->($class);



More information about the Bps-public-commit mailing list