[Bps-public-commit] r14695 - in Prophet/trunk: .

spang at bestpractical.com spang at bestpractical.com
Thu Jul 31 14:39:37 EDT 2008


Author: spang
Date: Thu Jul 31 14:39:36 2008
New Revision: 14695

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/CLI.pm

Log:
 r47480 at loki:  spang | 2008-07-31 19:34:34 +0100
 fix a bug where args/props aren't actually deleted, and change run_another_command to use add_to_prop_set correctly


Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI.pm	Thu Jul 31 14:39:36 2008
@@ -339,11 +339,17 @@
     }
 }
 
-=head2 run_another_command ( args => $hashref, props => $hashref, type => 'str' )
+=head2 run_another_command ( args => $hashref, props => $arrayref, type => 'str' )
 
 A hook for running a second command from within a command without having
 to use the commandline argument parsing.
 
+C<props> should be an array reference of hashes containing the keys C<prop>,
+C<cmp>, and C<value>, such as what is expected by the C<prop_set> attribute
+(see L<parse_args>'s use of C<add_to_prop_set>).
+
+C<args> should be a simple array of arg / value pairs.
+
 If C<type>, C<uuid>, or C<primary_commands> are not passed in, the values
 from the previous command run are used.
 
@@ -365,8 +371,10 @@
         }
     }
     if (my $props = $args{props}) {
-        foreach my $prop (keys %$props) {
-            $self->set_prop($prop => $props->{$prop});
+        foreach my $prop (@$props) {
+            my $key = $prop->{prop};
+            my $value = $prop->{value};
+            $self->set_prop($key => $value);
             $self->add_to_prop_set($prop);
         }
     }
@@ -391,7 +399,7 @@
 sub clear_args {
     my $self = shift;
 
-    foreach my $arg ($self->args) {
+    foreach my $arg (keys %{$self->args}) {
         $self->delete_arg($arg);
     }
 }
@@ -405,7 +413,7 @@
 sub clear_props {
     my $self = shift;
 
-    foreach my $prop ($self->props) {
+    foreach my $prop (keys %{$self->props}) {
         $self->delete_prop($prop);
     }
     $self->prop_set( ( ) );



More information about the Bps-public-commit mailing list