[Bps-public-commit] r14852 - in Prophet/branches/dispatcher: lib/Prophet/CLI

sartak at bestpractical.com sartak at bestpractical.com
Wed Aug 6 11:59:38 EDT 2008


Author: sartak
Date: Wed Aug  6 11:59:36 2008
New Revision: 14852

Modified:
   Prophet/branches/dispatcher/   (props changed)
   Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm

Log:
 r68858 at onn:  sartak | 2008-08-06 11:59:19 -0400
 Simplify the dispatcher, the app can have more complex rules


Modified: Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm
==============================================================================
--- Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm	(original)
+++ Prophet/branches/dispatcher/lib/Prophet/CLI/Dispatcher.pm	Wed Aug  6 11:59:36 2008
@@ -10,23 +10,14 @@
     run($1, $cli, @_);
 };
 
-on qr{(.*)} => sub {
+on qr{^(\w+)} => sub {
     my $cli = shift;
     my %args = @_;
 
-    my @possible_classes;
-
-    my @pieces = split ' ', $1;
-
-    for my $main ($cli->app_class, "Prophet") {
-        push @possible_classes, $main
-                              . "::CLI::Command::"
-                              . ucfirst lc $pieces[-1];
-    }
-
-    for my $main ($cli->app_class, "Prophet") {
-        push @possible_classes, $main . "::CLI::Command::NotFound";
-    }
+    my @possible_classes = (
+        ("Prophet::CLI::Command::" . ucfirst lc $1),
+        "Prophet::CLI::Command::Notound",
+    );
 
     for my $class (@possible_classes) {
         if ($cli->_try_to_load_cmd_class($class)) {



More information about the Bps-public-commit mailing list