[Bps-public-commit] r16454 - in Prophet/branches/class-dispatch: .

sartak at bestpractical.com sartak at bestpractical.com
Tue Oct 21 16:31:41 EDT 2008


Author: sartak
Date: Tue Oct 21 16:31:39 2008
New Revision: 16454

Modified:
   Prophet/branches/class-dispatch/   (props changed)
   Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm

Log:
 r74324 at onn:  sartak | 2008-10-21 16:31:27 -0400
 Include more arguments to command object creation


Modified: Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm
==============================================================================
--- Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm	(original)
+++ Prophet/branches/class-dispatch/lib/Prophet/CLI/Dispatcher.pm	Tue Oct 21 16:31:39 2008
@@ -55,7 +55,21 @@
         my $self = shift;
         my $class = $self->class_name($name);
         Prophet::App->require($class);
-        $class->new(cli => $self->cli)->run;
+
+        my %constructor_args = (
+            cli      => $self->cli,
+            context  => $self->context,
+            commands => $self->context->primary_commands,
+            type     => $self->context->type,
+            uuid     => $self->context->uuid,
+        );
+
+    # undef causes type constraint violations
+    for my $key (keys %constructor_args) {
+        delete $constructor_args{$key}
+            if !defined($constructor_args{$key});
+    }
+        $class->new(%constructor_args)->run;
     };
 }
 



More information about the Bps-public-commit mailing list